Page 1 of 1

Show latest release of software download

Posted: Thu Jul 01, 2004 10:20 am
by hairyjim
Hi all,

If I have posted this in the wrong forum then my apologies.

I just can't figure the logic or how to do this in my head.

Basically I have a table of product downloads. This table holds all the data for all the product downloads available.

What I wish to do is to display on a page the latest release for each product. So rather than getting a full list of all the releases just get the latest version for each product and diplay them in a list.

So for instance there could be 5 Product A downloads and 3 Product B downloads. I want to select the latest download for both Product A and Product B and list them.

Product A Release 01/07/04
Product B Release 25/06/04

Do I make sense?

Hope someone can give me some sort of inspiration, my mind has turned to mush now.

Posted: Thu Jul 01, 2004 10:28 am
by kettle_drum
Store the releases in a database and then do an ORDER BY date_released with DISTINCT product name, and then print the results.

Posted: Thu Jul 01, 2004 10:59 am
by hairyjim
Ahhh fantastic. And here I was thinking of some complex loop.

So how would I build the SQL statement so I can display the title of these records etc.

For instance if I did this:

Code: Select all

$sql = "SELECT DISTINCT product, title, DATE_FORMAT(release_date,'%d/%m/%Y') as formatted_release_date FROM downloads ORDER BY release_date";
It would select the unique Products, titles etc. How do I do the DISTINCT selection but still get accesss to the other fields?

Posted: Fri Jul 02, 2004 3:04 am
by hairyjim
Can I access the other fields in the DB when I use a 'distinct' query?