Write a query to retrieve latest records from the target table means if we have used scd2 version type of dimension, than retrieve the record with highest version no.for eg verno id loc 1 100 bang 2 100 kol 1 101 bang 2 101 chenwe have to retrieve 100/kol and 101/chen. how it is possible through query.

Questions by ravi214u   answers by ravi214u

Showing Answers 1 - 18 of 18 Answers

Ranganath Nagaraj

  • Feb 12th, 2007
 

answer is here for your question:1. Get the distict value and put order by desc for version Id.. you can get the latest record..

  Was this answer useful?  Yes

sai

  • Feb 14th, 2007
 

hi solution is here. hi ranganath ,u r answer is wrong,it will give latest of all employee records.but the question is ,latest record of each employee.for this ,this is d answerselect x.* from tablewname x where rowid in (select max(rowid) from tablename group by empno );i hope this will be the exact answer.

  Was this answer useful?  Yes

Rvinder Ravula

  • Apr 3rd, 2007
 

Dear Friend

select * from table_name where rowid in (select max(rowid) from table_name groupby verno);


U try this one...

Thanks
Ravinder Ravula

  Was this answer useful?  Yes

Chetan

  • Mar 2nd, 2018
 

What if the we have
1,100,Banglore
2,100,chennai
3,100,Mysore
1,101,bangalore
2,101,Kol
Your query will retun 2,3 and we will get
2,100,chennai
3,100,Mysore
2,101,Kol as output

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions