|
|
select distinct on one field, return two
|
|
|
|
Fresh-Faced Recruit
Join Date: May 2002
Location: Ft Lauderdale
Status:
Offline
|
|
I have field1 where there are repeats, but I only want distinct rows returned. I also need to select field2 which is a timestamp of when the row was entered. If I do:
select distinct field1, field2 from table
it returns everything b/c it is giving me distinct based on both fields. Is there a way to get distinct for just field1 and yet return 2 fields?
|
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Mar 2001
Status:
Offline
|
|
Have you tried
SELECT Distinct(field1), field2
FROM table
I woudl think a set of parens placed in the right...place would benefit.
|
|
|
|
|
|
|
|
|
Fresh-Faced Recruit
Join Date: May 2002
Location: Ft Lauderdale
Status:
Offline
|
|
I will try that when I get home, looks like what I was looking for, thank you.
|
|
|
|
|
|
|
|
|
Fresh-Faced Recruit
Join Date: May 2002
Location: Ft Lauderdale
Status:
Offline
|
|
No dice, I get the same results with or without parenthesis. select field1, field2 from table group by field1 seems to be giving me only distinct field1 rows. Thanks for help.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|