Tag Info

New answers tagged

-2

CREATE TEMPORARY TABLE IF NOT EXISTS temp (Months VARCHAR(50),Sequence INT) AS ( SELECT CONCAT(MONTHNAME(m1),' ',YEAR(m1)) AS Months,CONVERT(m1,DATE) AS Sequence FROM ( SELECT ('2014-01-01' - INTERVAL DAYOFMONTH('2014-01-01')-1 DAY) +INTERVAL m MONTH AS m1 FROM ( SELECT @rownum:=@rownum+1 AS m FROM (SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4) ...


0

With a large set you may want to use an NOT EXISTS clause rather than a NOT IN clause. It will help if you index the id on your feed table. Using an index will allow the optimizer to use the index rather than reading the table. Try a query like: DELETE FROM table WHERE NOT EXISTS ( SELECT feed.id FROM feed WHERE feed.id = table.id ) ...


5

You should specify the length of the varchar column e.g. varchar(2000).



Top 50 recent answers are included