Problem with Null constraint
i have a query where in i need to retrive only tickets where reviewed is null and status as ready for production.
SELECT A.CallStatus,B.RELEASE_DATE,B.CRReviewed
FROM CALLLOG A
JOIN Detail B
ON B.CallID=A.CallID
WHERE CallStatus='ready for production'
AND Release_date
between
'2011-11-01'and
'2011-12-02'
i am getting data till this part of the query,and tickets where reviewed is null but when i add reviewed is null and want to view only null tickets it is not givng
me any data.
SELECT A.CallStatus,B.RELEASE_DATE,B.CRReviewed
FROM
CALLLOG A
JOIN Detail B
ON B.CallID=A.
CallID
WHERE CallStatus=
'ready for production'
AND Release_date
between
'2011-11-01'and
'2011-12-02'
and reviewed is null
i
am not getting any data.
msmustard
December 5th, 2011 8:30pm
Hi,
Please post your table DDL with sample data and the expected output. We may be able to help in that case.
Thanks,
JanosThere are 10 type of people. Those who understand binary and those who do not.
My Blog
Free Windows Admin Tool Kit Click here and download it now
December 6th, 2011 2:01am
Ok, just an idea. What about LEFT or RIGHT OUTER JOIN instead of INNER JOIN?There are 10 type of people. Those who understand binary and those who do not.
My Blog
December 6th, 2011 2:06am
What's the data type of column REVIEWED? Does it allow NULLS? It could be that there's no records with a REVIEWED value of NULL (which by the way is different than a blank string) Jeff Wharton
MSysDev (C.Sturt), MDbDsgnMgt (C.Sturt), MCT, MCPD, MCITP, MCDBA
Blog: Mr. Wharty's Ramblings
MC ID:
Microsoft Transcript
Please mark answered if I've answered your question and vote for it as helpful to help other user's find a solution quicker
Free Windows Admin Tool Kit Click here and download it now
December 6th, 2011 5:21am
Reviewed is a column which tells if the ticket is reviewed or not. it has values as yes, blank and null in the column.msmustard
December 6th, 2011 11:21am
SELECT A.CallStatus,B.RELEASE_DATE,B.CRReviewed
FROM
CALLLOG A
JOIN Detail B
ON B.CallID=A.
CallID
WHERE CallStatus=
'ready for production'
AND Release_date
between
'2011-11-01'and
'2011-12-02'
and (reviewed is null OR LTRIM(RTRIM(reviewed))
= '' )
Regards,
Asim Bagwan
Kindly mark the replies as Answers if they help!
Free Windows Admin Tool Kit Click here and download it now
December 6th, 2011 1:43pm
Reviewed is a column which tells if the ticket is reviewed or not. it has values as yes, blank and null in the column.
msmustard
The datatype for this column should be BIT. Why do you allow Yes, blank and NULL? If it's not yes, it must be no.Jeff Wharton
MSysDev (C.Sturt), MDbDsgnMgt (C.Sturt), MCT, MCPD, MCITP, MCDBA
Blog: Mr. Wharty's Ramblings
MC ID:
Microsoft Transcript
Please mark answered if I've answered your question and vote for it as helpful to help other user's find a solution quicker
December 6th, 2011 5:04pm