Reputation: 274
This is a portion of my query. I fail to understand where is the problem in my query. The query is not working. It shows blank field.
If I add else 'abc'
then 'abc' shows in the field.
case cc.min_col
when 'sm1'
then (select CASE least(SUM(`j100`), SUM(`j119`), SUM(`j128`))
WHEN `j100` THEN '100'
WHEN `j119` THEN '119'
WHEN `j128` THEN '128'
ELSE 'abc'
END from `smc1a`)
end) as min_no
Upvotes: 1
Views: 64
Reputation: 710
Try this
case cc.min_col
when 'sm1'
then (select CASE least(SUM(`j100`), SUM(`j119`), SUM(`j128`))
WHEN SUM(`j100`) THEN '100'
WHEN SUM(`j119`) THEN '119'
WHEN SUM(`j128`) THEN '128'
END from `smc1a`)
end) as min_no
Upvotes: 2