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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Insert into Multiple rows in two tables (SQL)

Status
Not open for further replies.

john96113

Programmer
Aug 20, 2003
5
US
Hey, I am a NEW comer, I try to write a ASP with DB-MS-Access, I encounter trouble,

Table 1 (order table)

OrderNo, CustomerNo.
1 011
2 033
3 023

Table 2 ( DetailOrder)

OrderNo, ItemNo, itemDescription
: : :
3 111 car
3 112 truck

-- For example customer 023 order 111 and 112 in OrderNo 3
Please help me how to write this SQL to put data order 3 in to both tables at same time with INSERT, Thank you very much.






 
There is no SQL to do that.

You will need two SQL statements, one for each table.

Furthermore you will need to perform the INSERT command multiple times to add the order details.

That is the way it works.
 
Wow, Nobody reply my message, maybe my question is not clear.. My question is when I click order button, for

Order No (3 ) CustomerNo (023)

will INSERT INTO the Table ORDER,

Then how could I write a SQL to pass (insert into) this Order No 3 to Detail TABLE with 2 orders like this

OrderNo, ItemNo, itemDescription
3 111 car
3 112 truck
Thanks.
John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top