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

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -