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).
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.