Monday, April 1, 2013

Of MySQL’s query returns the highest number from PHP?


Main problem courtesy of josh: How would you return the highest number of a mysql query in PHP?

Say i had a query that was “select email from users”. I’ve selected the whole column of “email”. How would i return the highest number in that whole field? Is that even possible?


Definitely is pertaining to How would you return the highest number of a mysql query in PHP? that you may possibly choose to resolve problems themselves. Hopefully you like this assists in lots of ways, making your own life better. With the expectation pertaining to How would you return the highest number of a mysql query in PHP? should be a strategy as time goes on.

Best answer:


Answer by twee_grrrl

use the sql MAX command.


http://www.plus2net.com/sql_tutorial/sql_max.php


Answer by raina_vissora

The highest number? I’m not sure I understand what you’re after. Wouldn’t the email field be a text data type, as opposed to a numerical data type?


If for some reason you’ve named a numerical field “email”, you could just for SELECT * FROM `users` ORDER BY `email` DESC LIMIT 1; or just SELECT MAX(`email`) FROM `users`;. That would give you the highest value in a numerical column.


Understand or know far better?

Add the answer in the comments!


Email training that works.


email


View by email


email



Of MySQL’s query returns the highest number from PHP?

No comments:

Post a Comment

Blog Archive