> what version of MySQL are you running? I get this:-
mysql> select version();
+-------------------+
| version() |
+-------------------+
| 5.1.63-0+squeeze1 |
+-------------------+
I'm asking that because I have a trouble with a select..
I have something similar..
SELECT @sec:=IF(GROUP_CONCAT(DISTINCT secA.sec_code SEPARATOR '|') is null,
IF(GROUP_CONCAT(DISTINCT secB.sec_code SEPARATOR '|') is null, settore,
GROUP_CONCAT(DISTINCT secB.sec_code SEPARATOR '|')),
GROUP_CONCAT(DISTINCT secA.sec_code SEPARATOR '|') ) as settore,
SELECT CASE(
WHEN SUBSTR(@sec,1,23)="..." THEN ...
WHEN SUBSTR(@sec,1,12)="..." THEN ...
WHEN SUBSTR(@sec,1,34)="..." THEN ...
)
FROM (several left joins)
and it seems the "sec" variable is always the 'previous one' and not the result from the
nested 'if' :(