Friday, 23 August 2013

SQL first occurance of a string

SQL first occurance of a string

I have a query which returns results like
Jim 456
Joe 567
Joe 789
Jane 456
What I want to do is have 456 only appear once and take the first name
(Jim). Query looks like
select p.id_id as num_id,
p.FIRST_NAME || ' ' || p.LAST_NAME as Name_
from DWH.V_TABLE p
where p.id_id>100
The reasons for this is I need each to have only one owner, not two

No comments:

Post a Comment