Getting most & least records with select

I have the query

SELECT MAX( assetValue ) AS most, MIN( assetValue ) AS least FROM Assets

which returns the expected result (the most/least expensive assetValues in the table, but how do I find out the assetType also for each?

SELECT Assets.assetType , Assets.assetValue FROM ( SELECT MAX( assetValue ) AS most , MIN( assetValue ) AS least FROM Assets ) AS extrema INNER JOIN Assets ON Assets.AssetValue IN ( extrema.most , extrema.least )

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.