Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6588899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:06:20+00:00 2026-05-25T17:06:20+00:00

I have created following select: select e.first_name, e.last_name, (select jobname_id from (select j.id, j.jobname_id,

  • 0

I have created following select:

select e.first_name, e.last_name, 
   (select jobname_id from 
       (select j.id, j.jobname_id, first_value(j.jobname_id) 
        over (order by j.date_from desc) as current_job 
        from jobs j where j.emp_id=e.emp_id and j.date_from < sysdate) 
    where jobname_id != current_job and rownum=1) as previous_job 
from employees e

but I get “ORA-00904: “E”.”EMP_ID”: invalid identifier”

how can I use the reference to E.EMP_ID in the subquery?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T17:06:21+00:00Added an answer on May 25, 2026 at 5:06 pm

    I don’t know if this solution ist fast enough for your needs but it should work as planned.
    Also, I agree with Ollie about the additional field “date_to”. It would make things easier.

    select
      e.first_name   as first_name,
      e.last_name    as last_name,
      sub.jobname_id as jobname_id
    from 
      employees e,
      (
        select
          j.emp_id     as emp_id,
          j.jobname_id as jobname_id,
          row_number()
            over (
              partition by j.emp_id
              order by     j.date_from desc
            ) as job_order
        from
          jobs j
        where j.date_from < sysdate
      ) sub
    where sub.emp_id    = e.emp_id
      and sub.job_order = 2
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following query: SELECT src_big, created, modified, owner, aid, caption FROM photo
I have created a PHP code to echo the following div <div id=main_catsel> <select
I have the following query: SELECT l.id, (SELECT amount FROM lead_status WHERE lead_id =
I have the following MySQL query and tables from which I am querying: SELECT
I have the following test-code: CREATE TABLE #Foo (Foo int) INSERT INTO #Foo SELECT
I have created following rule in the .htaccess file located at the root of
I have created following thing in android using android compatibility support package Basically i
I have created the following string field for indexing. <fieldType name=short_text_for_sort class=solr.StrField omitNorms=true sortMissingLast=true
I have created the following stored procedure.. CREATE PROCEDURE [dbo].[UDSPRBHPRIMBUSTYPESTARTUP] ( @CODE CHAR(5) ,
I have created the following C library for reading an image: typedef struct {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.