Conditional Conditons in SQL Server

前端 未结 2 978
慢半拍i
慢半拍i 2021-01-29 07:06

I have a combobox with 3 values: All, Failed, Completed.

ALL: load All rows and no condition. Failed and

2条回答
  •  北海茫月
    2021-01-29 07:33

    DECLARE @status varchar(15)
    
    --set the status
    
    SELECT * 
    FROM tbl_Location
    WHERE Status = @status OR @status = 'ALL'
    

提交回复
热议问题