Query Syntax error

后端 未结 4 1683
渐次进展
渐次进展 2021-01-27 23:14

Please help me correct the following query:

SQL = \"insert into tblContract (Empid, Start1, Finish1, Store1, \" & _
                    \"Start2, Finish2, St         


        
4条回答
  •  面向向阳花
    2021-01-27 23:59

    If anything is going to work, you will have to embed the sub-query inside an extra layer of parentheses:

    INSERT INTO SomeTable(Col1, Col2, Col3)
        VALUES(val1, (SELECT MAX(testid) FROM tbltesting), val3);
    

    Be aware that you are vulnerable to SQL Injection attacks.


    Using IBM Informix Dynamic Server 11.50 in a database with a 'table of elements', the following works:

    create temp table t(i integer, j integer, k integer);
    insert into t values(1, (select max(atomic_number) from elements), 2);
    select * from t;
    
    1   118     2
    

    This is correct given the current data in the table of elements.

提交回复
热议问题