I am using an SQL database to track parking.
I am trying to write a query to get data.
Should be simple, but of course it's not.
The problem is:
There are 3 ways to refer to a parking stall. StallNumber, PermitNumber, and CardNumber. Problem is, not all records have all three fields. Record 1 has a StallNumber. 2 has a Permit number, 3 has a card number.
I want to fill a list with the StallNumber, if no StallNumber exists, show the PermitNumber, if no PermitNumber, show the CardNumber.
The closest I got is:
SELECT
StallID,
isnull(isnull(StallNumber,PermitNumber), CardNumber)
FROM Stall
Any suggestions?
Thanks
Ray
I am trying to write a query to get data.
Should be simple, but of course it's not.
The problem is:
There are 3 ways to refer to a parking stall. StallNumber, PermitNumber, and CardNumber. Problem is, not all records have all three fields. Record 1 has a StallNumber. 2 has a Permit number, 3 has a card number.
I want to fill a list with the StallNumber, if no StallNumber exists, show the PermitNumber, if no PermitNumber, show the CardNumber.
The closest I got is:
SELECT
StallID,
isnull(isnull(StallNumber,PermitNumber), CardNumber)
FROM Stall
Any suggestions?
Thanks
Ray