Jump to content

[SOLVED] SQL Query


hellouthere

Recommended Posts

Hello again, Barand has recently given me a query for selecting the most recent record from a database...

 

	$lstsql = "SELECT p.pilot_id , p.name, MAX(r.report_id) AS latest
	FROM pilots AS p INNER JOIN reports AS r ON p.pilot_id = r.pilot_id
	WHERE p.pilot_id='$pid'
	GROUP BY p.name";

 

i now need to select the 5 most recent results... i have seen other ways of doing it but cannot reproduce them...

 

any help is appreiciated...

 

thanks in advance....

 

(also the correct spelling for appreiciated ::))

Link to comment
https://forums.phpfreaks.com/topic/45061-solved-sql-query/
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.