Reputation: 179
I have this chunk of SQL from a stored procedure and i can convert almost all of it, except for the 'INTO #t1' line which i believe is a temporary table:
SELECT siteid, MIN(Eload) + dbo.GetOffset(siteid, 'Eload', MIN(time)) AS Eload
INTO #t1
FROM calcdata WITH (NOLOCK)
WHERE siteid IN (SELECT siteid FROM community_site WHERE communityid = @communityid)
AND time between @start AND @finish
AND Eload < 1000000
AND Eload <> 0
GROUP BY siteid
What is the MySQL equivalent of the INTO #t1 line?
Thanks
Upvotes: 0
Views: 152
Reputation: 2249
MySQL does not allow to create temporary tables on the fly. You can create temporary table explicitly (see reference), but you are generally better off with simply creating normal table and dropping it after you are done with it. If you were to create it explicitly and fill, you need to know all fields in advance, which could be cumbersome.
Upvotes: 0
Reputation: 121952
You should use INSERT ... SELECT statement instead of SELECT with INTO.
Upvotes: 2