0

Im trying to merge two tables on the id level

The schema of the two tables is from the SQL Command below:

CREATE TABLE Table1
    (ID int, Name varchar(1))
;
    
INSERT INTO Table1(ID, Name) 
VALUES
    (1, 'A'),
    (2, 'B'),
    (3, 'C'),
    (4, 'D')
;

CREATE TABLE Table2 (ID int, Factor DECIMAL(5,1));

When I use the SQL command

INSERT into Table2 (ID, Factor)
SELECT Table1.ID, Factors.a 
FROM (VALUES (1), (1.2), (3.4), (2.8) ) AS Factors(a), Table1

I now get the error #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(a), t1' at line 3

  • 1
    Phpmyadmin is for mysql. MS SQL server is a different database product created by Microsoft. Mysql does not support cross apply, MS SQL server does. – Shadow Sep 27 '22 at 07:43

0 Answers0