mjoy
mjoy

Reputation: 680

SQL Query having trouble creating temporary table

I am trying to use the my table adult3 to create a temporary table with rows from the column class that correspond to the condition:

SELECT class INTO #CLTable
FROM adult3
WHERE (class = '<=50K');

but I keep getting the error :

ERROR 1064 (42000): 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
'FROM adult3
WHERE (class = '<=50K')' at line 2

I don't get what I'm doing wrong.

Upvotes: 0

Views: 929

Answers (2)

rtd5033
rtd5033

Reputation: 46

I believe that you are using SQL Server syntax for creating a temp table.

Try this:

create temporary table CLTable as 
select class from adult3
where (class='<=50K');

Upvotes: 2

Jimmy Hadley
Jimmy Hadley

Reputation: 1

You could try:

    INSERT INTO [tempTableName]
    SELECT class FROM adult3
    WHERE (class='<=50k')

Upvotes: 0

Related Questions