Conditional Conditons in SQL Server

前端 未结 2 980
慢半拍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:51

    Make your combo-box to send a parameter call @status. Send @status = null when you need to load all row.

    Select *
    from tbl_location
    where @status is null or status = @status;
    

提交回复
热议问题