List:General Discussion« Previous MessageNext Message »
From:MAS! Date:October 4 2012 2:13pm
Subject:Re: (real) silly question about variables...
View as plain text  
> 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' :(


Thread
(real) silly question about variables...MAS!4 Oct
  • Re: (real) silly question about variables...Derek Downey4 Oct
  • Re: (real) silly question about variables...rich gray4 Oct
    • Re: (real) silly question about variables...MAS!4 Oct
      • Re: (real) silly question about variables...hsv6 Oct
  • RE: (real) silly question about variables...Martin Gainty4 Oct