Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Can somebody make this query right?

Author  Topic 

Rita Bhatnagar
Posting Yak Master

172 Posts

Posted - 2002-04-25 : 16:13:53
I know the case statement is not right.Thanks for any help.

SELECT A.BillingSetupID, A.StartDateTime, A.EndDateTime, B.ChargeLinkNumber, A.ReversalID, A.PayorName, A.NetChargeAR,
A.CostItemID, A.CptItem, LastBillingTrackingID AS BillNO, A.BillingSetupEnteredDate
FROM BillingSetup AS A
INNER JOIN BillingSource AS B
ON A.BillingSetupID = B.BillingSetupID
WHERE A.CareRecipientID = @prmCareRecipientID
And (Case When @prmReversalCondition ='R' then ReversalID > 0
When @prmReversalCondition = 'N' then ReversalID=0
Else ReversalID=>0 End)
ORDER BY A.StartDateTime, A.EndDateTime, A.PayorName


Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2002-04-25 : 16:24:11
SELECT A.BillingSetupID, A.StartDateTime, A.EndDateTime, B.ChargeLinkNumber, A.ReversalID, A.PayorName, A.NetChargeAR,
A.CostItemID, A.CptItem, LastBillingTrackingID AS BillNO, A.BillingSetupEnteredDate
FROM BillingSetup AS A
INNER JOIN BillingSource AS B
ON A.BillingSetupID = B.BillingSetupID
WHERE A.CareRecipientID = @prmCareRecipientID
And ((@prmReversalCondition ='R' and ReversalID > 0) or
(@prmReversalCondition = 'N' and ReversalID=0 ) or
(@prmReversalCondition not in ('R','N') and ReversalID >=0))
ORDER BY A.StartDateTime, A.EndDateTime, A.PayorName


It was all I could do to not reformat you code

<O>

Edited by - Page47 on 04/25/2002 16:24:29
Go to Top of Page

Rita Bhatnagar
Posting Yak Master

172 Posts

Posted - 2002-04-25 : 16:55:20
Thanks.

Go to Top of Page
   

- Advertisement -