mtkr Posted May 19, 2016 Report Posted May 19, 2016 create table #table1 ( id varchar(10), name varchar(10) ) insert into #table1 values ( '1', 'sam') insert into #table1 values ('2', 'ram') select * from #table1 create table #table2 ( id varchar(10), number varchar(10) ) insert into #table2 values ( '1', '456') insert into #table2 values ('1', '789') insert into #table2 values ( '2', '023') insert into #table2 values ('2', '956') select * from #table1 id name 1 sam 2 ram select * from #table2 id number 1 456 1 789 2 023 2 956 select p.* from ( select a.id, a.name, b.number, ROW_NUMBER() OVER(PARTITION BY b.id ORDER BY b.id ) as new_id from #table1 a right outer join #table2 b on a.id = b.id )p where p.new_id = 1 id name number new_id 1 sam 456 1 2 ram 023 1 Quote
nenu_devudni Posted May 19, 2016 Author Report Posted May 19, 2016 35 minutes ago, loveindia said: aa select statement ki aa result ki relation ekkada undi man? Date field edanna undaa aa query lo... intaki aa 5 records which is the one you want to see man? 34 minutes ago, loveindia said: ;WITH CTE AS( SELECT SELECT * FROM CTE WHER Rnum = 1 something like this will help you man... edi google lo chusinay vuncle ...kani etla vadalo ardam kale ..tanks .. oo sari na util lo petti try chesi chepta .. Quote
loveindia Posted May 19, 2016 Report Posted May 19, 2016 2 minutes ago, nenu_devudni said: edi google lo chusinay vuncle ...kani etla vadalo ardam kale ..tanks .. oo sari na util lo petti try chesi chepta .. ide cheyyali man for ur result set.. enjoy man.... Quote
nenu_devudni Posted May 19, 2016 Author Report Posted May 19, 2016 love india vuncle ... neku future lo kidney avasaram unte sepp .. tesi ichesta ..ur logic worked great ya ... extract tesi ma odi mohana kotta .. Quote
loveindia Posted May 19, 2016 Report Posted May 19, 2016 1 minute ago, nenu_devudni said: love india vuncle ... neku future lo kidney avasaram unte sepp .. tesi ichesta ..ur logic worked great ya ... extract tesi ma odi mohana kotta .. endi man ippudu neeku code raasina papaniki naa kidney povalnaa.... yabbbeeeeey...... Quote
nenu_devudni Posted May 19, 2016 Author Report Posted May 19, 2016 love thatha .. nu esina post lo .. aa table name gatra update seyva .. ma appice lo evadu aina google sesi ee post kanapadaithe .. na drawyer sinigipodi Quote
loveindia Posted May 19, 2016 Report Posted May 19, 2016 thread musey thread musey man inka.... Quote
nenu_devudni Posted May 19, 2016 Author Report Posted May 19, 2016 etla muyali vuncle theddu ... eyadam ee kani epudu muyaledu Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.