Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > select distinct on one field, return two

select distinct on one field, return two
Thread Tools
Fresh-Faced Recruit
Join Date: May 2002
Location: Ft Lauderdale
Status: Offline
Reply With Quote
Jul 16, 2002, 11:55 AM
 
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
Reply With Quote
Jul 21, 2002, 09:54 PM
 
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
Reply With Quote
Jul 23, 2002, 01:50 PM
 
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
Reply With Quote
Jul 23, 2002, 11:01 PM
 
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.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -4. The time now is 02:05 AM.
All contents of these forums © 1995-2015 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2015, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2