StuBabyAight
asked on
MS SQL MAX QUERY, how do I return "multiple" MAX values in one query?
I have two tables. One contains a big pile of product information as well as the page number that the item appears in, in a catalog. The second table contains the imagePath for the items, but each item has two images associated with it. One is low res, the other high res. Using the supplier code, how do I return only the high res imagePaths for each code? I feel that MAX is the right path to proceed down, but I'm probably wrong.
SELECT MAX(tblImagePaths.fldItemS ize) AS LargeImage, tblSupplierData.fldPage, tblImagePaths.fldItemCode
FROM tblSupplierData
INNER JOIN tblImagePaths ON tblSupplierData.fldItemCod e = tblImagePaths.fldItemCode
WHERE (tblImagePaths.fldItemCode , 5) = @monthYear) AND (tblSupplierData.fldPage = @pageNumber)
GROUP BY tblImagePaths.fldItemSize, tblSupplierData.fldPage, tblImagePaths.fldItemCode
SELECT MAX(tblImagePaths.fldItemS
FROM tblSupplierData
INNER JOIN tblImagePaths ON tblSupplierData.fldItemCod
WHERE (tblImagePaths.fldItemCode
GROUP BY tblImagePaths.fldItemSize,
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Awesome, thanks very much!
ASKER
Page 5, Item 65, Imagepath c:\etc, etc
Page 5, Item 66, Imagepath c:\etc, etc
Page 5, Item 67, IamgePath c:\etc, etc