CREATE TEMPORARY TABLE temporal(
IP varchar(15) NULL
);
CREATE TEMPORARY TABLE temporal_2(
IP varchar(15) NULL
);
SELECT IF (NULL = (SELECT IP FROM temporal WHERE IP = '0' LIMIT 1),
(INSERT INTO temporal_2(IP) VALUES ('1')),(SELECT NULL LIMIT 1));
DROP TEMPORARY TABLE temporal;
DROP TEMPORARY TABLE temporal_2;
Error
[Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO temporal_2(IP) VALUES ('1')),(SELECT NULL LIMIT 1))' at line 2
Quiero hacer esto de SQL server pero en MySQL. El equivalente a esto:
CREATE TABLE #Temp (IP varchar(15))
INSERT #Temp (IP)VALUES (0)
IF NOT EXISTS (SELECT IP FROM #Temp WHERE IP = 0)
BEGIN
PRINT 'Entro'
END
DROP TABLE #Temp