Access INSERT with nested SELECT

前端 未结 2 643
梦毁少年i
梦毁少年i 2021-01-15 06:02

Why does the following SQL statement not work?

INSERT INTO dialog (speaker, dialog_text) VALUES (
    (
        SELEC         


        
相关标签:
2条回答
  • 2021-01-15 06:26

    An Access SQL INSERT ... VALUES statement will not let you use a subquery for one of the VALUES

    Switching to an INSERT ... SELECT statement, as Piotr suggested will work.

    Or you could use an Access Domain Aggregate function, instead of a subquery, in your INSERT ... VALUES statement:

    INSERT INTO dialog (speaker, dialog_text)
    VALUES (
        DMin("id", "FIGURE", "char_name='Doe' AND forename='John'"),
        'Some text'
    );
    
    0 讨论(0)
  • 2021-01-15 06:41

    Following works:

       INSERT INTO dialog (speaker, dialog_text) 
                SELECT FIRST(id), "Some text"
                FROM FIGURE
                WHERE char_name="Doe" AND forename="John"
    
    0 讨论(0)
提交回复
热议问题