mysql - How to avoid conditional multiple SELECT in a query -
i select this simple sql
(case is when (select name customers where customers_id Customer = Customer) is not Zero (name Select from Customers where Customers_id = Customer) and Customer End) as Customer, DateStart, ProgramsRun.Programs_id, RunInSeconds, SwSQL, SwProgram, Name Programs Run Run ProgramName from left ProgramsRun.Programs_id = joining program programs .Programs_id; My question is how can I make two similar selection statements: in the form of a condition and the other as the price selection. I know that I can make a temporary variable, but it forces me to use stored procedures or temporary tables, is there an easy way to avoid this?
You can use it as IFNULL : IFNULL ((Where customers name customers_id = customer, select customer) or COALESCE like this: Reference:
-
Comments
Post a Comment