从连接查询中选择最大值

时间:2013-08-13 23:22:36

标签: sql

此查询结果一列包含许多行,每个单元格包含一个数字:

SELECT B.Bil_Total_Remain
  FROM Bill_Sales B 
  JOIN Customer C ON B.Bil_Cus_Id=C.Cus_Id AND C.Cus_name = 'asd'

如何在查询结果中检索最大数量?

1 个答案:

答案 0 :(得分:2)

select max(B.Bil_Total_Remain) as your_max_value
from Bill_Sales B 
join Customer C on B.Bil_Cus_Id=C.Cus_Id 
                and C.Cus_name = 'asd'