Louie,
Do you want just the most recent date? You could run :
SELECT MAX(dateposted)
FROM datafiles
WHERE office='AC/PA'
OR if you want just the "most recent" record:
SELECT dateposted, filename
FROM datafiles
WHERE office='AC/PA'
ORDER BY dateposted desc
LIMIT 1;
OR you could also ask for that same record this way (depending on your
MySQL version):
SELECT dateposted, filename
FROM datafiles d
INNER JOIN (SELECT MAX(dateposted) as maxdate
FROM datafiles
WHERE office='AC/PA') as mx
ON mx.maxdate = d.dateposted
WHERE office='AC/PA'
Yours,
Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine
Louie Miranda <[EMAIL PROTECTED]> wrote on 07/16/2004 03:11:02 AM:
> List,
>
> How can i issue a query that can select last dateposted (FIELD)?
> My table:
>
> - dateposted, format: YYYY-MM-DD
>
> This is my current sql query which catches in desc order for
> dateposted and list only 10 sql data.
>
> select
> dateposted,
> filename,
> description
> from datafiles
> where office = 'AC/PA'
> order by
> dateposted desc limit 10";
>
>
>
> --
> Louie Miranda
> http://www.axishift.com
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
>