From: MAS! Date: October 4 2012 2:13pm Subject: Re: (real) silly question about variables... List-Archive: http://lists.mysql.com/mysql/228319 Message-Id: <329EC458-72C7-42CE-9FB5-7188273C3C1B@gmail.com> MIME-Version: 1.0 (Apple Message framework v1283) Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable > 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:=3DIF(GROUP_CONCAT(DISTINCT secA.sec_code SEPARATOR '|') is = null, = =20 IF(GROUP_CONCAT(DISTINCT secB.sec_code SEPARATOR '|') is = null, settore, GROUP_CONCAT(DISTINCT secB.sec_code SEPARATOR '|')), = =20 GROUP_CONCAT(DISTINCT secA.sec_code SEPARATOR '|') ) = as settore, =20 SELECT CASE( WHEN SUBSTR(@sec,1,23)=3D"..." THEN ... WHEN SUBSTR(@sec,1,12)=3D"..." THEN ... WHEN SUBSTR(@sec,1,34)=3D"..." THEN ... ) FROM (several left joins) and it seems the "sec" variable is always the 'previous one' and not the = result from the nested 'if' :(