Morning,
I cant work out why my query (below) is ignoring the WHERE clause for the amzLive. And is still returning duplicates.
SELECT asin
FROM dbo.aboProducts
WHERE (asin NOT IN
(SELECT DISTINCT productAsin
FROM dbo.LowestPrices
WHERE (priceDate > GETDATE() - 1))) AND (amzLive = 'true')
It is returning a list of items, but still bringing back the ones where amzLive is set to true or false.
Can someone see where I am going wrong?
Update
DB structure as requested…
aboProducts Table
id int Unchecked
asin nvarchar(50) Checked
codeType int Checked
sku nvarchar(50) Unchecked
amzPrice decimal(18, 2) Checked
amzLive bit Checked
lastUpdated datetime Checked
LowestPrices Table
id int Unchecked
productAsin nvarchar(50) Unchecked
price decimal(18, 2) Unchecked
postage decimal(18, 2) Checked
priceDate datetime Unchecked
twAmzPrice decimal(18, 2) Checked
left joinwill make your query clearer and more predictableeg