How do I query multiple data values in same field?

  • Thread starter Thread starter dcMcK
  • Start date Start date
D

dcMcK

I need to create a query that returns first record of every group. So far, I
can write sql statement to pull all occurance of defined groups (i.e. Peach,
Apple). But can't pull first record of any group. I'm new to query! How do I
accomplish this?

Apple (500-record occurances)
Orange (400-records occurances)
Peach (50-record occurances)
banana (20-record occurances)

Results: first record of each group:\apple\orange\peach\banana
 
dcMcK said:
I need to create a query that returns first record of every group. So far, I
can write sql statement to pull all occurance of defined groups (i.e. Peach,
Apple). But can't pull first record of any group. I'm new to query! How do I
accomplish this?

Apple (500-record occurances)
Orange (400-records occurances)
Peach (50-record occurances)
banana (20-record occurances)

Results: first record of each group:\apple\orange\peach\banana


There is no such thing as a "first" record. Each record
would have to have one or more fields that can be used to
sort the records in a unique way before you can define what
"first" means.

Without that, you may get the records in any order and which
one appears first is close to a random chance. If you don't
care which one you get, then you can use something like:

SELECT [group], First(thingy)
FROM table
GROUP BY [group]
 
Back
Top