mysql - My sql statement has two parts attached with 'union all'. I want the second part to exceecute only when some condition is true -
my query big paste here , refers @ least 15 tables, pasting small example explain problem
select city, country customers country='germany' union select city, country suppliers country='germany' order city;
i want union part of query execute when condition true ( comes ui in parameter), e.g. boolean combo=true
.
thanks
what this:
select city, country customers country='germany' union select city, country suppliers country='germany' , @combo = true order city;
it still runs second part of union return records if @combo true. saves lots of if else statements. helps if have many queries in union each query can have it's own @combo variable.
Comments
Post a Comment