Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

INSERT + Subquery

Status
Not open for further replies.

Benedikt83

Programmer
Mar 21, 2003
5
DE
Hallo!

Can anyone tell me why this Access-Query doesn't work?

INSERT INTO Pieces (Piece, idComposer)
VALUES ('Song XY', (SELECT idComposer
FROM Composers
WHERE Name = 'ComposerXY'));

An Error is raised that tells that there was no description to it.

Thank you in advance!
Benedikt Höfl
 
it doesn't work because you cannot mix VALUES and SELECT like that

try this --

INSERT INTO Pieces (Piece, idComposer)
SELECT 'Song XY', idComposer
FROM Composers
WHERE Name = 'ComposerXY'


rudy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top