I run this query on MSSQL successfully, however it does not run very well on MySql (query is being executed..). This is the first time MySQL has choked running a query. Also tried this on different computers both remote (LAN) and local db connections. MySQL Query Browser is not hanging or returning errors, just runs and runs until I cancel it!
Q. How can I increase code efficiency for MySQL?
Purpose: Insert only new records (no matching 'Logged' datetime's) into Secured table from the Main table Where Port (Ports table) is marked Secure
Also not using 'Group By' hoping it would speed things up.
Secured = tinyint(1)
Logged = datetime
Priority = varchar(50)
Port = varchar(10)
Insert into Secured (Cleared,Logged,Priority, Port)
(SELECT 0, Logged,Priority, Port
FROM Main m
JOIN Ports p on p.Port = m.Port
Where p.Secure = '1'
And m.Logged Not In (Select Logged From Secured)