Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Nested Select statement

Author  Topic 

grevs
Starting Member

1 Post

Posted - 2006-10-21 : 17:56:16
Hi,

As an example, I am trying to execute the following query:

INSERT INTO MYTABLE (var1, var2) VALUES ('some text', (SELECT value FROM TABLE2 WHERE ID=2))

But it will not work. How do I go about inserting the resultant from a SELECT statment into an INSERT statement?

Thanks

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2006-10-21 : 18:08:25

INSERT INTO MYTABLE 
(var1, var2)
Select
'some text',
value
FROM
TABLE2
WHERE
ID=2


CODO ERGO SUM
Go to Top of Page
   

- Advertisement -