Greetings all,

I've got a mysql select issue that's been bugging me for a while, that I then 
forgot about, and has no surfaced again while trying something out.

I have thousands of records in a mysql database and I'm trying to do what I 
thought would be a simple select statement using either max() or limit 1 DESC.

The problem is, it is returning the second newest or last record, not the very 
newest or last record.

Is this comon or am I just missing a simple step?
*************
My select statement goes like this:

$query="SELECT equipment.type AS type, equipment.menu AS menu, pireps.id AS id, 
pireps.departure_airport AS dep, 
pireps.arrival_airport AS arr, pireps.aircraft AS aircraft, pireps.month AS 
month, pireps.day AS day, pireps.year 
AS year,  pireps.date_filed AS date_filed
FROM pireps
LEFT JOIN equipment ON pireps.aircraft = equipment.type
WHERE pireps.pilot_id=$pilot_id AND pireps.aircraft IS NOT NULL 
GROUP BY equipment.type
ORDER BY pireps.id DESC LIMIT 1
***********

Thanks for any help.

Lance

[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
<font face=arial size=-1><a 
href="http://us.ard.yahoo.com/SIG=12htjqhvd/M=362131.6882499.7825260.1510227/D=groups/S=1705005703:TM/Y=YAHOO/EXP=1123785169/A=2889191/R=0/SIG=10r90krvo/*http://www.thebeehive.org
">Get Bzzzy! (real tools to help you find a job) Welcome to the Sweet Life 
- brought to you by One Economy</a>.</font>
--------------------------------------------------------------------~-> 

Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to