Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Limiting a Query result to the last 50 records

Status
Not open for further replies.

elentz

Technical User
Jan 9, 2007
81
US
I have a query that is getting me ALL the records from two tables. For one application I have I only need the last 30 records. I tried Limit 30 but that only got me the first 30. The table is ever growing so I will never know the number of records in the tables until I run the query. Here's my query:

$sql = "SELECT a.dealer_name, a.pi_name, b.pub_ip, b.date, b.time, b.latency, b.jitter, b.loss, b.mos, b.sip_status_before FROM pi_config a, pi_data b WHERE a.pi_id = b.pi_id ORDER BY b.date";


How can I do this??

Thanks alot for looking
 
Order descending (ORDER BY b.date DESC) and then take LIMIT 30.

Bye, Olaf.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top