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_.sequenc
e AS [Incident],
_SMDBA_._udstatus_.ID AS [Status],
_SMDBA_._PERSONNEL_.code AS [Assigned To],
_SMDBA_._GROUPS_.code AS [Group],
_SMDBA_._SUBJECTS_.descrip
tion AS [Category Description],
[Date Open],
[Closed On],
synopsis as [Synopsis],
_SMDBA_._TELMASTE_.descrip
tion 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_.sequenc
e
AND _SMDBA_._TELMASTE_.[sent to] *= _SMDBA_._PERSONNEL_.sequen
ce
AND _SMDBA_._TELMASTE_.subject
*= _SMDBA_._SUBJECTS_.sequenc
e
AND _SMDBA_._TELMASTE_.[seq_Se
verity:] *= _SMDBA_._SEVERITY_.sequenc
e
AND _SMDBA_._TELMASTE_.[seq_ud
status:] *= _SMDBA_._UDSTATUS_.sequenc
e
AND _SMDBA_._TELMASTE_.[seq_ud
status:] <> 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_.sequenc
e = isnull(@status, _SMDBA_._UDSTATUS_.sequenc
e )
ORDER BY status DESC
Thanks,
R
r
Start Free Trial