View Full Version : Pull random records


cowannbell
07-07-2008, 05:37 AM
I have a table that has names and address and an address number. There are multiple address numbers but the names may be different. I only need one record for each address number and it doesn't matter which name i pulls. How can I accomplish this.


Thanks,

redneckgeek
07-07-2008, 06:30 AM
If it doesn't really matter which names is pulled, then just pull the first one. ;)

Select Address, FIRST(Name) AS Name
FROM your_table
GROUP BY Address

cowannbell
07-07-2008, 07:46 AM
I'm confused on this part. I need to pull the entire record but only one per address #.

Select Address, FIRST(Name) AS Name

The field name of the Address is address#.

Are you saying it should look like this:

SELECT [(Grp AZ & CO Providers)].*, FIRST [Address #] AS Address #
FROM [(Grp AZ & CO Providers)]
GROUP BY [Address #]

cowannbell
07-07-2008, 09:44 AM
I found the answer.

http://support.microsoft.com/kb/292634