diddydustin
Programmer
Hey guys,
I'm using the following query:
SELECT r.intQueID
,ri.chrISBN
,case isnull(p.intProductID,0)
WHEN 0 THEN
case ri.chrRecordStatus WHEN 'E' THEN -1 ELSE 0 END
ELSE 1
END bAvalible
FROM dbo.tblQuery r
INNER JOIN dbo.tblQueryItem ri
ON r.intQueID = ri.intQueID
LEFT OUTER JOIN tblProduct p
ON p.chrISBN = ri.chrISBN
WHERE sdtExpires > getdate()
It returns results like these:
47 0020005105 0
47 0020005105 0
47 0020005105 0
47 0020016700 0
47 0020016700 0
47 0020016700 0
47 0020080956 0
47 0020080956 0
47 0020080956 0
47 002009745X 0
47 002009745X 0
47 002009745X 0
47 0020100604 0
47 0020100604 0
47 0020100604 0
47 0020103514 0
47 0020103514 0
47 0020103514 0
47 0020103700 0
47 0020103700 0
47 0020103700 0
47 002011690X 0
47 002011690X 0
47 002011690X 0
However, the table looks like this:
47
0020005105 A 2005-06-13 13:33:48.357 47
0020016700 A 2005-06-13 13:33:48.357 47
0020080956 A 2005-06-13 13:33:48.357 47
002009745X A 2005-06-13 13:33:48.357 47
0020100604 A 2005-06-13 13:33:48.357 47
0020103514 A 2005-06-13 13:33:48.357 47
0020103700 A 2005-06-13 13:33:48.357 47
002011690X A 2005-06-13 13:33:48.357
Why is this query returning 3 of everything? Thank you!
Dustin
I'm using the following query:
SELECT r.intQueID
,ri.chrISBN
,case isnull(p.intProductID,0)
WHEN 0 THEN
case ri.chrRecordStatus WHEN 'E' THEN -1 ELSE 0 END
ELSE 1
END bAvalible
FROM dbo.tblQuery r
INNER JOIN dbo.tblQueryItem ri
ON r.intQueID = ri.intQueID
LEFT OUTER JOIN tblProduct p
ON p.chrISBN = ri.chrISBN
WHERE sdtExpires > getdate()
It returns results like these:
47 0020005105 0
47 0020005105 0
47 0020005105 0
47 0020016700 0
47 0020016700 0
47 0020016700 0
47 0020080956 0
47 0020080956 0
47 0020080956 0
47 002009745X 0
47 002009745X 0
47 002009745X 0
47 0020100604 0
47 0020100604 0
47 0020100604 0
47 0020103514 0
47 0020103514 0
47 0020103514 0
47 0020103700 0
47 0020103700 0
47 0020103700 0
47 002011690X 0
47 002011690X 0
47 002011690X 0
However, the table looks like this:
47
0020005105 A 2005-06-13 13:33:48.357 47
0020016700 A 2005-06-13 13:33:48.357 47
0020080956 A 2005-06-13 13:33:48.357 47
002009745X A 2005-06-13 13:33:48.357 47
0020100604 A 2005-06-13 13:33:48.357 47
0020103514 A 2005-06-13 13:33:48.357 47
0020103700 A 2005-06-13 13:33:48.357 47
002011690X A 2005-06-13 13:33:48.357
Why is this query returning 3 of everything? Thank you!
Dustin