Reputation: 21
this is my table value like
masterid dateorder Ist IInd IIIrd IVth Vth VIth
------------------------------------------------------------------------
08mcaao1 1 MC1701 MC1702 MC1703 Mc1704 Mc1705 Mc1701
08mcaao1 2 MC1701 MC1702 MC1703 Mc1703 Mc1705 Mc1702
08mcaao1 3 MC1701 MC1703 MC1703 Mc1704 Mc1705 Mc1701
if i'm select this table based on column value like MC1701
the result must be this form
masterid dateorder Ist IInd IIIrd IVth Vth VIth
-------------------------------------------------------------------
08mcaao1 1 MC1701 - - - - Mc1701
08mcaao1 2 MC1701 - - - - -
08mcaao1 3 MC1701 - - - - Mc1701
Upvotes: 2
Views: 117
Reputation: 12493
declare @param as nvarchar(100)
set @param = 'whatever'
select
...
case when Ist = @param then Ist else '-' end 'Ist'
...
where Ist = @param or ...
Upvotes: 0
Reputation: 117047
Use a CASE statement on fields Ist, IInd, IIIrd, IVth ,Vth, VIth to compare it against your criteria. If it matches with your criteria display the value otherwise display -
Upvotes: 1