Nested Query

P

Programmer

I want to insert into table1 and read max ID at same time and use this query
in MSACCESS 2000. it rerurns an error. How can I correct it?
Insert Into Table1(ID,QTY) Values(
(Select Max(ID)+1 From Table1)
,50)
 
M

MGFoster

Programmer said:
I want to insert into table1 and read max ID at same time and use this query
in MSACCESS 2000. it rerurns an error. How can I correct it?
Insert Into Table1(ID,QTY) Values(
(Select Max(ID)+1 From Table1)
,50)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Correct syntax is:

INSERT INTO Table1 (ID, Qty)
SELECT MAX(ID)+1, 50 FROM Table1

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSUeyHIechKqOuFEgEQKrcACgromIfuc3rWOax0/XWO7KdXXs3aIAoPc0
lSzHzdveZmS5U/aIPsMx/Kua
=veAs
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top