I have a pricing table for a retail software that holds a UPC for an item, a property code (i.e. "REGULAR_PRICE, PROMO_PRICE"), and a price.
example table:
400000320243 REGULAR_PRICE 80
400000320243 PROMO_PRICE 80
400000320250 REGULAR_PRICE 50
400000320250 PROMO_PRICE 40
I am trying to write a query to find where the PROMO_PRICE = REGULAR_PRICE for any UPCs and output a list of the UPCs where this condition holds.
I cannot figure out how to write this in SQL. I am using SQL Server 2008 R2.
Attempted pseudo code:
for each upc:
if upc.regular_price = upc.promo_price:
print upc