Ver Mensaje Individual
  #5 (permalink)  
Antiguo 02/08/2012, 05:14
Avatar de dontexplain
dontexplain
 
Fecha de Ingreso: junio-2012
Mensajes: 536
Antigüedad: 11 años, 11 meses
Puntos: 127
Respuesta: Limitación para registros en una tabla (MySQL)

Mysql es muy limitado a la hora de procesar estructuras if-else y no existen condicionantes en UPDATE

SELECT IF((SELECT COUNT(*) FROM tabla)=134,'es 134','no es 134')

sin embargo lo siguiente sólo sería posible para consultas que retornan un sólo registro

SELECT IF((SELECT COUNT(*) FROM tabla)=134,(SELECT COUNT(*) FROM tabla),'no es 134')
ó
SELECT IF((SELECT COUNT(*) FROM tabla)=134,4*5,'no es 134')

Pero no es capaz de hacer

SELECT IF((SELECT COUNT(*) FROM tabla)=134,(INSERT INTO...),'no es 134')

Un saludo.
__________________
21añero.
HTML/CSS, PHP, JS/jQuery, Mysql; NodeJS/Socket.io (& V8); C++ ; Python (wxpy); Ensamblador.
Músico (clarinetista/pianista) y compositor