Advertisement

06.05.2008 at 11:12AM PDT, ID: 23461329
[x]
Attachment Details

How can I eliminate null values from returning?

Asked by RhondaCarroll in SQL Query Syntax

Tags: MS SQL

Hi,

I have the following query below. When I run it and enter the start date and end date, it returns all rows correctly. When I then select a status (for example 'OPEN' it returns all records with an open status and at the end it also returns records with a different status (example closed, pending etc) and the status field in the records appears blank. How can I modify my query to just return the records based on a selected status and not all of them?

SELECT      _SMDBA_._CUSTOMER_.client AS [Client],
         _SMDBA_._SEVERITY_.name AS [Priority],
         _SMDBA_._TELMASTE_.sequence AS [Incident],
         _SMDBA_._udstatus_.ID AS [Status],
                 _SMDBA_._PERSONNEL_.code AS [Assigned To],
                 _SMDBA_._GROUPS_.code AS [Group],
                 _SMDBA_._SUBJECTS_.description AS [Category Description],
                 [Date Open],
                 [Closed On],
                  synopsis as [Synopsis],
                  _SMDBA_._TELMASTE_.description AS [Incident Description],
                  Resolution
FROM         _SMDBA_._TELMASTE_, _SMDBA_._GROUPS_, _SMDBA_._CUSTOMER_, _SMDBA_._PERSONNEL_, _SMDBA_._SUBJECTS_,
                 _SMDBA_._SEVERITY_, _SMDBA_._UDSTATUS_
WHERE      _SMDBA_._TELMASTE_._group_ *= _SMDBA_._GROUPS_.sequence
                AND _SMDBA_._TELMASTE_.client *= _SMDBA_._CUSTOMER_.sequence
                AND _SMDBA_._TELMASTE_.[sent to] *= _SMDBA_._PERSONNEL_.sequence
        AND _SMDBA_._TELMASTE_.subject *= _SMDBA_._SUBJECTS_.sequence
                AND _SMDBA_._TELMASTE_.[seq_Severity:] *= _SMDBA_._SEVERITY_.sequence
                AND _SMDBA_._TELMASTE_.[seq_udstatus:] *= _SMDBA_._UDSTATUS_.sequence
                AND _SMDBA_._TELMASTE_.[seq_udstatus:] <> 1004
                AND _SMDBA_._telmaste_.client IN (33882, 32303, 2023, 2002, 34153, 34046, 34349, 34099, 1795, 1657, 34053, 34193,                                                                     34243, 31979, 34032, 29504, 1712, 1590)
                AND _SMDBA_._telmaste_.client  = isnull(@client, _SMDBA_._telmaste_.client )
        AND ([date open] between @startdate AND @enddate)
        AND  _SMDBA_._UDSTATUS_.sequence  =  isnull(@status, _SMDBA_._UDSTATUS_.sequence )
ORDER BY status DESC



Thanks,
R
rStart Free Trial
 
Loading Advertisement...
 
[+][-]06.05.2008 at 11:43AM PDT, ID: 21722656

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.05.2008 at 11:45AM PDT, ID: 21722682

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.07.2008 at 11:10AM PDT, ID: 21736361

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: SQL Query Syntax
Tags: MS SQL
Sign Up Now!
Solution Provided By: mark_wills
Participating Experts: 2
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628