Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Select help -- distinguishing between identical names
Hi Dave,
How about
SELECT DISTINCT DISTRICT_NAME,DISTRICT_ID FROM DISTRICT_TABLE; If you want it to look like your example you can concatenate brackets and the word ID etc etc...but this should give you the results you want.
Regards,
Steve
"D. Alvarado" <laredotornado_at_zipmail.com> wrote in message
news:9fe1f2ad.0205080706.6ee1037c_at_posting.google.com...
> Hello,
> I am using Oracle 8.1.7 for Solaris. I have a table with the
> following structure ...
>
> DISTRICT_NAME DISTRICT_ID
> ------------- -----------
> Austin 30
> Laredo 18
> Wylie 28
> Wylie 14
>
> I would like to write a select statement that returns all the district
> names so that each is unambiguous. So a statement like "SELECT
> DISTRICT_NAME FROM DISTRICT_TABLE" would return
>
> DISTRICT_NAME
> -------------
> Austin
> Laredo
> Wylie
> Wylie
>
> which is ambiguous (Wylie is there twice). I would prefer a query
> that did something of the following...
>
> DISTRICT_NAME
> -------------
> Austin
> Laredo
> Wylie (ID: 28)
> Wylie (ID: 14)
>
> Any ideas, Thanks, Dave
Received on Wed May 08 2002 - 11:05:34 CDT
![]() |
![]() |