简体   繁体   中英

MySQL Query Max/Min Field

使用格式为Col1Col2Col3的查询都包含整数值,如何根据该查询创建第二个查询,该查询具有第四个字段,该字段显示字段名称( Col1Col2Col3 ),该字段具有该记录的最高值,第五显示记录最低值的字段名称?

Have a look at using GREATEST

With two or more arguments, returns the largest (maximum-valued) argument.

and LEAST

With two or more arguments, returns the smallest (minimum-valued) argument.

SQL Fiddle DEMO

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM