SELECT CCategoryID, CCategoryName, SUM(FCommentNO) AS SumComment
FROM Category AS C, Feedback AS F, Article AS A
WHERE CCategoryID=ACategoryID AND AArticleID=FArticleID
GROUP BY CCategoryID, CCategoryName having SUM(FCommentNO)=
(select min(t1SumComment1) from
(SELECT SUM(FCommentNO) AS SumComment1
FROM Category AS C, Feedback AS F, Article AS A
WHERE CCategoryID=ACategoryID AND AArticleID=FArticleID
GROUP BY CCategoryID, CCategoryName) as t1)
这样试试
使用聚合函数min()求最小值,对应max()求最大值。
SELECT roomID FROM room WHERE guestNumber = (SELECT MIN(guestNumber) FROM room)
以上就是关于SQL从查询结果中查最小值全部的内容,包括:SQL从查询结果中查最小值、如果查询出MySQL里某字段值最小的记录ID号、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)