Greetings All!
I'm close!! (I think
)
Just trying to create a Case Statement that has three criteria and returns three values.
This works great but I can't seem to figure out how to go to the next case statement if the first value is false
Code:
SELECT CASE WHEN LEFT(A.SalesID, 3) ='AAA'THEN'Boo'END As Poo, IIf(Sales ='R','Rural','City') AS Boo2, IIf(Del ='S','Standard','Overnight') AS Boo3
FROM Dbo.MTable A JOIN Dbo.Delivery B
ON A.SalesID = B.SalesID
WHERE B.Tracking_Number ='111-123456'
The only other CASE will be when LEFT(A.SalesID, 3) = 'BBB' the other criteria will remain the same as below
Code:
SELECT CASE WHEN LEFT(A.SalesID, 3) ='BBB' THEN 'Boo' END As Poo, IIf(Sales ='R','Rural','City') AS Boo2, IIf(Del ='S','Standard','Overnight') AS Boo3
FROM Dbo.MTable A JOIN Dbo.Delivery B
ON A.SalesID = B.SalesID
WHERE B.Tracking_Number ='111-123456'
So I guess what I am trying to do is somehow combine these statements?
And yes the codes does come from SSMS - I like to develop in SSMS then move it over to Access VBE
Thanks for any help~