hi...

you guys misunderstood my question...

i don't want to insert into one tbl from multiple tables....

i want to insert into multiple tables simultaneously using a single query...



-----Original Message-----
From: Visolve DB TEAM [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 15, 2006 10:55 AM
To: [EMAIL PROTECTED]; mysql@lists.mysql.com
Subject: Re: multiple table inserts


Hell Bruce

Yes ,Here is the solution to insert the values from multiple table into a
table . We can achieve this by using the JOINs(INNER JOIN,LEFT JOIN,RIGHT
JOIN, join)

Consider the tables Animal,Feed and Animalfeed

Structure of the animal table

Id
name
variety

Structure of the feed table

id
Feed

Structure of animal table
id
Name
feed

I wan to update the table Animalfeed from  tables Animal and Feed

INSERT INTO Animalfeed   SELECT a.id,a.name,b.feed FROM Animal a,feed b
WHERE a.id=b.id

Note:
1.Column Order of animalfeed table and SELECT QUERY must be SAME Datatype
2.If you want to insert the name and feed details  into animalfeed table .
The query must be follow below synatx

INSERT INTO Animalfeed(name,feed)  SELECT a.name,b.feed from Animal a,feed b
WHERE  a.id=b.id

Thanks
Visolve DB TEAM.

----- Original Message -----
From: "bruce" <[EMAIL PROTECTED]>
To: <mysql@lists.mysql.com>
Sent: Tuesday, August 15, 2006 8:26 PM
Subject: multiple table inserts


> hi...
>
> the mysql docs don't seem to allow this.. but i'll ask.
>
> is there a way to accomplish:
>
> insert into cat,dog (cat.x,dog.y) values (1,2)
>
> allowing me to essentially insert items into multiple tables
> simultaneously...
>
> thanks
>
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:
> http://lists.mysql.com/[EMAIL PROTECTED]
>


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to