•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 425,937 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,611 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MySQL advertiser: Programming Forums
Views: 2654 | Replies: 1
![]() |
| |
•
•
Join Date: Oct 2005
Location: Manchester, UK
Posts: 482
Reputation:
Rep Power: 3
Solved Threads: 33
•
•
•
•
hi ,
I have four different tables, all are linked together using foreign key relationships.
Now i need to insert data in to the tables.How can i use nested insert queries to insert data by a single query?
I suggest using transactions (you need the InnoDB storage engine for this).
SQL Syntax (Toggle Plain Text)
start transaction INSERT INTO blah... INSERT INTO blah... commit
If one of your statements causes an error none will be committed so you won't get corrupted data / missing keys etc.
Note to self... pocket cup
![]() |
•
•
•
•
•
•
•
•
DaniWeb MySQL Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- SQL Queries help (Database Design)
- database connection(select ,insert query) within javascript function (JSP)
- Moving database to new server (MySQL)
- Insert Into (PHP)
- MySql multiple table query problem.... (MySQL)
- using asp array to store db information (ASP)
- MySQL nested query / joined query conversion help (MySQL)
Other Threads in the MySQL Forum
- Previous Thread: speed of insert into a MySQL db
- Next Thread: Database and web design


Hybrid Mode