View previous topic :: View next topic
|
Author |
Message |
ssowmya
New User
Joined: 10 Oct 2006 Posts: 40
|
|
|
|
Hi All
I have a table with following info
Vendor-ID Vendor-Name Loc-Name Loc-Seq
00001 Vendor1 A 1
00001 Vendor1 B 1
00002 Vendor2 A 2
00002 Vendor2 A 2
00002 Vendor2 B 1
00003 Vendor3 A 3
I want to extract the records in following format
Vendor-ID Vendor-Name Loc-Name Loc-Seq
00001 Vendor1 A 1
00002 Vendor2 A 2
00003 Vendor3 A 3
That is the first occurrence of Vendor_ID
Please help..... |
|
Back to top |
|
|
vicky10001 Warnings : 1 Active User
Joined: 13 Jul 2005 Posts: 136
|
|
Back to top |
|
|
raghunathns
Active User
Joined: 08 Dec 2005 Posts: 127 Location: rochester
|
|
|
|
You mean the column loc-seq is duplicate and find the location which is occuring first.
try this.
select * from tbl1 x
where 0 = (select count(*) from tbl1 y
where y.vendor-name = x.vendor-name
and y.Loc-Seq = x.Loc-Seq
and y.loc-name < x.loc-name)
order by x.vendor-id
. |
|
Back to top |
|
|
|