Re: Condicionar con variables @ en mysql
Tu sintaxis es correcta:
mysql> SET @Var1:= (SELECT MAX(Colm1) FROM TablaA);
Query OK, 0 rows affected (0.02 sec)
mysql> SET @Var2:= (SELECT MAX(Colm1) FROM TablaB);
Query OK, 0 rows affected (0.00 sec)
mysql> SELECT IF(@Var1 <= @Var2, @Var2, @Var1);
+----------------------------------+
| IF(@Var1 <= @Var2, @Var2, @Var1) |
+----------------------------------+
| 5 |
+----------------------------------+
1 row in set (0.00 sec)
--
Jaime Crespo
http://dbahire.com
Subject
Views
Written By
Posted
7493
July 17, 2014 06:03PM
Re: Condicionar con variables @ en mysql
1553
July 17, 2014 06:57PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.