sassy_luvr24
New Member
I need to write a query to retrieve values from two columns using mysql tableMy table has the following strucutre\[code\]| ID | user_id | datetime | message | | 1 | 21 | 2012-05-10 04:13:01 | message1 | | 2 | 07 | 2012-05-10 04:17:51 | message2 | | 3 | 21 | 2012-05-11 04:21:51 | message3 | | 4 | 21 | 2012-05-11 04:43:51 | message4 | | 5 | 07 | 2012-05-11 04:21:51 | message5 | | 5 | 21 | 2012-05-11 04:43:51 | message6 | \[/code\]i wrote the below query$query="SELECT MAX(datetime) FROM \[code\]messages\[/code\] where user_id=21 and date=2012-05-11";but i am not getting latest record from table iam getting null valuehelp us