Hello,
I have been learning more and more about building complex queries using joins and case statements, but i cannot find examples on the net for the specific syntax of these 2 queries im trying to execute. They both involve taking a user defined variable, such as a store id combined with a DISTINCT and a MIN function.
Basically i have a table Inventory which has the columns ProductUPC, StoreID, and Price.
So there could be the same ProductUPC linked to different stores but each store can only have one of each ProductUPC and each ProductUPC has a price.
-Both queries will have the StoreID variable passed to them:
1st Query (low price leader):
Select all the products (ProductUPCs) where the StoreID passed to the query has the lowest price of any store.
2nd Query (this store only):
Select all the products (ProductUPCs) for a given StoreID that are unique for that StoreID and not listed by any other store in Inventory table.
Would really appreciate any help,
Dan
I have been learning more and more about building complex queries using joins and case statements, but i cannot find examples on the net for the specific syntax of these 2 queries im trying to execute. They both involve taking a user defined variable, such as a store id combined with a DISTINCT and a MIN function.
Basically i have a table Inventory which has the columns ProductUPC, StoreID, and Price.
So there could be the same ProductUPC linked to different stores but each store can only have one of each ProductUPC and each ProductUPC has a price.
-Both queries will have the StoreID variable passed to them:
1st Query (low price leader):
Select all the products (ProductUPCs) where the StoreID passed to the query has the lowest price of any store.
2nd Query (this store only):
Select all the products (ProductUPCs) for a given StoreID that are unique for that StoreID and not listed by any other store in Inventory table.
Would really appreciate any help,
Dan
Comment