How do I query multiple data values in same field?

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
 
M

Marshall Barton

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]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top