Jump to content

Select DISTINCT with more than one column


soltek

Recommended Posts

Hey there, It'd be awesome if you could help me out with this:

 

What I'm trying to do is to select from the db all the new products of the day, BUT is there's 2 products with the same categorie, display only the last one.

Something like this:

SELECT id, date, txt, categorie FROM products WHERE date=$today AND [categorie is unique]

ORDER by date;

 

The part I'm having trouble with is the one between brackets.

Maybe this should be done in the loop, I've no idea.

 

Also I could use SELECT DISTINCT, but this wont allow me to select only the distincted column (categorie), right?

 

If you could give me a hand, it'd be awesome.

Thanks

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.