jd2007 Posted August 15, 2007 Share Posted August 15, 2007 $que="select col1 from table where col2=MAX(col2)"; mysql_query($que); Quote Link to comment https://forums.phpfreaks.com/topic/65029-solved-hi-can-i-do-a-mysql-query-as-below/ Share on other sites More sharing options...
pranav_kavi Posted August 15, 2007 Share Posted August 15, 2007 u can do, $que="select col1 from table where col2= ( select MAX(col2) from table ); mysql_query($que); Quote Link to comment https://forums.phpfreaks.com/topic/65029-solved-hi-can-i-do-a-mysql-query-as-below/#findComment-324525 Share on other sites More sharing options...
trq Posted August 15, 2007 Share Posted August 15, 2007 Have you tried it? The correct syntax would be.... SELECT col1 FROM table ORDER BY col2 DESC LIMIT 1; Quote Link to comment https://forums.phpfreaks.com/topic/65029-solved-hi-can-i-do-a-mysql-query-as-below/#findComment-324527 Share on other sites More sharing options...
jd2007 Posted August 15, 2007 Author Share Posted August 15, 2007 thanks Quote Link to comment https://forums.phpfreaks.com/topic/65029-solved-hi-can-i-do-a-mysql-query-as-below/#findComment-324535 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.