开发者

Selecting max value from calculated column in mysql

I have a mysql select statement which goes like this开发者_C百科:

Select a,b,calculated_column from table t1;

I come up with the calculated_column based on some logic and calculated_column is NOT a column in table t1.

How do I make this select statement return only the max value of the calculated_column?


Try using a derived table:

SELECT MAX(calculated_column) AS MyMax
FROM 
(
    SELECT a,b,calculated_column 
    FROM   table t1;
) t2
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜