php - incorrect my sql select statement results -
i have small mysql table with:
id
name
status
class
desk
date
username
it has around 300 records.
when selecting data latest record date
(formatted), along username
, use statement:
select date_format(max(date), '%d-%m-%y @ %h:%i'), username latestrecord mytable
it returns correct record datetime gives different username
not in same selected row. seems doesn't select username
same resulted lastest date/time.
any idea why happens?
if want latest record should add order by
, limit
clausule's query:
select date_format(date, '%d-%m-%y @ %h:%i') latestdate, username latestrecord mytable order date desc limit 1
Comments
Post a Comment