请帮帮我
我想知道电话号码是否为空或0,然后选择手机号码,如果手机号码也是0或空,然后选择0
DECLARE
@phoneNumber varchar(MAX),
@nReservationID varchar(MAX)
SELECT
@phoneNumber =
(CASE
WHEN ISNULL(RDG.nPhoneNumber ,'') IN ('0','-',NULL)
THEN ISNULL(RDG.nMobileNumber, '0')
WHEN ISNULL(RDG.nMobileNumber, '0') IN ('0','-',NULL)
THEN '0'
ELSE ISNULL(rdg.nPhoneNumber ,'0') END)
FROM tblReservation_Details_Guest RDG
WHERE RDG.nReservationID = @nReservationID