How to query the maximum value field in MySQL

Source: Internet
Author: User

The method for querying the maximum value in MySQL is not very complex. The following describes how to query the maximum value in MySQL. If you have encountered the problem of querying the maximum value field in MySQL, take a look.

 
 
  1. select a.*, b.count from (  
  2. select * from message  
  3. where to_uid=2026 and is_del<2 and from_uid>0  
  4.  
  5. order by mid desc  
  6. )   
  7. as a  
  8. join  
  9. (  
  10. select reply_id,count(*) as count from message  
  11. where reply_id>0  
  12. group by reply_id  
  13. )  
  14. as b  
  15. on (a.reply_id=b.reply_id)  
  16.  
  17. group by a.reply_id  
  18. order by a.mid desc  
  19.  
  20.  

MySQL query results are sorted by a certain value

Use functions to query row numbers in MySQL

Non-empty question in MySQL Query

Troubleshooting of MySQL query timeout

MySQL Date and Time Functions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.