I have table of shops name, ID, Type,etc. Also I have classes of shops (supermarkets, store, retailer) and each class has several types (supermarket = megamarket, multimarket, etc) I would like to get all shops which are supermarkets. Let's assume supermarkets is ShopClass 2.
So I would like to write query like this:
SELECT ShopID, ShopName
FROM Shops
WHERE ShopType in (SELECT ShopType FROM ShopClasses WHERE ShopClass = 2)
But unfortunately that query doesn't work:
Only one expression can be specified in the select list when the subquery is not introduced with EXISTS
What is the reason? AFAIK I can use expressions in IN statement.