syntax101 Posted December 8, 2007 Share Posted December 8, 2007 help how do you get the hightst number in the database ex. order_num 1 4 10 2 3 4 6 7 RESULT 10 Quote Link to comment Share on other sites More sharing options...
syntax101 Posted December 8, 2007 Author Share Posted December 8, 2007 i tried to use $sql = 'SELECT max(order_num) from orders '; - no result but it wont work in php then i tried it in phpyadmin select max(order_num) from `orders` - result ok it works can anybody help me. Quote Link to comment Share on other sites More sharing options...
syntax101 Posted December 8, 2007 Author Share Posted December 8, 2007 i already got it $sql = 'SELECT order_num from orders where order_num = (Select max(order_num) from orders)'; thanx to the moderator who taught me how to use select in a select data from table where data = (select ..) Quote Link to comment Share on other sites More sharing options...
fenway Posted December 9, 2007 Share Posted December 9, 2007 Actually, you don't need a subselect, it's just a single table: SELECT max(order_num) from orders Quote Link to comment 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.