Conditional Conditons in SQL Server -
i have combobox 3 values: all
, failed
, completed
.
all
: load rows , no condition. failed
, completed
: load condition on column 'status'.
all:
select * tbl_location
failed , completed:
select * tbl_location status = 'failed'
or
select * tbl_location status = 'completed'
i have 2 statues 'failed' , 'completed'. 'all' combo-box value load rows without condition
i want in 1 query. can do?
declare @status varchar(15) --set status select * tbl_location status = @status or @status = 'all'
Comments
Post a Comment