Jump to content

sub query help


tjc19999

Recommended Posts

Hello everyone, I need some help figuring out the proper subquery for my select statement.

 

Here are 2 codes that I have:

$result = mysql_query("SELECT * FROM applications WHERE history=(select MAX(history) FROM applications)");

$result = mysql_query("SELECT DISTINCT id FROM applications");

 

Both of these queries work, but what I need is a subquery that will

1) select DISTINCT id

2) for each distinct ID select max(history)

 

Thank you in advance if you can help.

Link to comment
https://forums.phpfreaks.com/topic/214393-sub-query-help/
Share on other sites

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.