SELECT all data WHERE one column is DISTINCT

danb

Registered User.
Local time
Today, 13:44
Joined
Sep 13, 2003
Messages
98
Hi,

I have a database with lots of rows. I want to return all data but only with a distinct "Title" value.

I've tried:

Code:
SELECT DISTINCT Title, * FROM etc etc...

But that doesn't seem to work.

Any help would be greatly appreciated, thanks.
 
No, sorry if that didn't make sense. What I wanted to achieve is quite simple, return all data from a database, but only where the values in the 'Title' column are distinct.

I've done it using GROUP BY which seems to be quite a long-winded way but the only way I can find.

Thanks.
 
Actually, the GROUP BY hasn't sorted it.

The columns I have are:

Id, Title, Description, Manufacturer, Price

Some of the products have the same title but different manufacturer. Basically, I need to return all of the data for a web listing, but only those whose titles are unique. The results have to be ordered by title, and where there is more than one similar title, the results must show the product of minimum price.

Does this make sense, and can anyone help?? Thanks.
 
danb,

What Pat is saying is that given the following data:

Code:
FirstName LastName Age
========= ======== ===
Joe       Smith     37
Joe       Jones     24
Frank     Smith     14
Fred      Williams  31

If you selected Distinct FirstName, you'd get
Joe, Frank, Fred. That's fine so far.

What would you expect with Select Distinct FirstName, * ...?

What should it return for the Joe row? Access can't decide
either. No relational database will make that decision for
you.

Wayne
 

Users who are viewing this thread

Back
Top Bottom