how to select with one unique column
I'm trying to create a select for one unique column and all the rows with
them are printed out. So far I've tried using DISTINCT keyword, but that
only works for all fields selected, I want to specify it to one field to
eliminate duplicates for that column. Any help please. Thanks
Andrew
[321 byte] By [
Andrew] at [2007-11-9 18:51:01]

# 1 Re: how to select with one unique column
Hi Andrew,
I'm not sure what you're trying to achieve..
Do you mean there could be a few rows that match your query but you only want
one (any one, doesn't matter which) to return?
Or, you want to fetch one complete row for each different value in a certain
column?
Can you give us a list of, say, 6 - 8 rows, and then a sample of the output
you would require from your query on those rows?
--Greg
Andrew wrote:
> I'm trying to create a select for one unique column and all the rows with
> them are printed out. So far I've tried using DISTINCT keyword, but that
> only works for all fields selected, I want to specify it to one field to
> eliminate duplicates for that column. Any help please. Thanks
>
> Andrew
# 2 Re: how to select with one unique column
Greg,
I agree with Greg. What is it you are trying to accomplish(Pseudo Code
or Business rules)? From what you say, it seems you may need to normalize
your data structure a little more. Can't tell for sure without seeing the
structure and the data.
Mark
Greg Nash <gnash@namoicotton.com.au> wrote:
>Hi Andrew,
>I'm not sure what you're trying to achieve..
>Do you mean there could be a few rows that match your query but you only
want
>one (any one, doesn't matter which) to return?
>Or, you want to fetch one complete row for each different value in a certain
>column?
>Can you give us a list of, say, 6 - 8 rows, and then a sample of the output
>you would require from your query on those rows?
>
>--Greg
>
>Andrew wrote:
>
>> I'm trying to create a select for one unique column and all the rows with
>> them are printed out. So far I've tried using DISTINCT keyword, but that
>> only works for all fields selected, I want to specify it to one field
to
>> eliminate duplicates for that column. Any help please. Thanks
>>
>> Andrew
>
Mark at 2007-11-12 0:05:46 >

# 3 Re: how to select with one unique column
"Andrew" <hung.yansaing@intria.com> wrote:
>
>I'm trying to create a select for one unique column and all the rows with
>them are printed out. So far I've tried using DISTINCT keyword, but that
>only works for all fields selected, I want to specify it to one field to
>eliminate duplicates for that column. Any help please. Thanks
>
>Andrew
Andrew:
you can try HAVING clause, something simular to HAVING COUNT(column)=1
keeping you DISTINCT or GROUP BY in.
Alex
Alex at 2007-11-12 0:06:45 >
