ORDER BY DESC LIMIT 1 is much simpler and more readable than a sub-query.
Though the sub-query approach looks to be a good template for ensuring more
accurate results by being more explicit.


Thanks to all who responded!
Scott



SELECT * FROM colortable WHERE color = 'red' ORDER BY date DESC LIMIT 1;



SELECT g.color, g.date, g.entered_by
    FROM giventable g
 WHERE g.color     = 'red'
      AND g.date =
                (SELECT MAX(g2.date)
                      FROM giventable g2
                   WHERE g2.color        = g.color
                )



---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Reply via email to