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

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -