I'm trying to do a fairly simple select of a
column from a table where the date of that column
happens to be the highest value. I tried this:

SELECT name FROM products WHERE prod_type='foo' AND
added=(SELECT MAX(added) FROM products WHERE
prod_type='foo');

But I get the error:

ERROR 1064: You have an error in your SQL syntax
near 'SELECT MAX(added) FROM products WHERE
prod_type='foo')' at line 1

Is there a problem with the parentheses? I've
used this syntax with Oracle before with no
troubles.

name and prod_type are TINYTEXT and added is
a DATE.

Is there another way I should be doing this? I
could probably order descending by the added date
and then just LIMIT 1, but I don't think that's
very clean.

'mysql --version' returns:

mysql  Ver 11.15 Distrib 3.23.41, for -freebsd4.4 (i386)

Thanks in advance,

-- 
Jeff "Shippy" Shipman     E-Mail: [EMAIL PROTECTED]
Computer Science Major    ICQ: 1786493
New Mexico Institute of Mining and Technology
Homepage: http://www.nmt.edu/~shippy


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to