本文介绍了SQL MAX()返回不同的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,
我有一张桌子,上面有图像的文件位置及其大小作为字段.我想返回最大图像的字段位置字段.使用MAX(fieldsize)可以得到正确的记录,但是如何返回不同的字段呢?

Hello,
I have a table with the file location of images and their sizes as fields. I want to return the fiel location field of the largest image. Using MAX(fieldsize) gets me the right record, but how do I return a different field?

SELECT MAX(fldItemSize) FROM tblItemImagePaths
    WHERE fldSupplierID = @SupplierID
    AND fldSupplierCode = @SupplierCode



当我包含需要查询的字段时,查询将返回两行数据.是的,我是这个新手:)



when I include the requried field, the query then returns two lines of data. Yes, I''m new to this :)

SELECT        MAX(fldItemSize) AS Expr1, fldItemPath
FROM            tblItemImagePaths
WHERE        (fldSupplierID = @SupplierID) AND (fldSupplierCode = @SupplierCode)
GROUP BY fldItemPath

推荐答案


这篇关于SQL MAX()返回不同的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-15 12:24
查看更多