Kinda dud question, my apologies - anyways you help will be appreciated, I want to optimize a query like :
if @parameter = 'abc'
select a.x, b.y.c.z
from tbl1 a,
tbl2 b,
tbl3 c
{ join statements }
order by a.x, b.y
if @parameter = 'abc'
select a.x, b.y.c.z
from tbl1 a,
tbl2 b,
tbl3 c
{ join statements }
order by a.x, c.z
etc..etc
Instead of repeating the code, how can i utilize something like a "switch" for my order by clause..
Thx.