You need to substitute t1_id, t3_id ... etc, for the appropriate field
names in the
other_table you are wanting to insert the values into.
The missing fields will be filled in with their default values:
INSERT INTO other_table (t1_id, t3_id, t2_id, g_description, g_price,
g_qty, g_comments)
SELECT distinct t1.id, t3.id, t2.id, g.description, g.price, g.qty,
g.comments FROM cp.Category t1, Gifts g, cp.Manufacturer t2, cp.Pattern
t3 WHERE t1.name = g.Category and t2.name = g.Manfacturer and t3.name =
g.pattern;
Kelley
dan orlic wrote:
I have an insert that I have to get to work from the following tables
here is my query:
Select distinct t1.id, t3.id, t2.id, g.description, g.price, g.qty,
g.comments from cp.Category t1, Gifts g, cp.Manufacturer t2, cp.Pattern
t3 where t1.name = g.Category and t2.name = g.Manfacturer and t3.name =
g.pattern;
This yields the correct 7 values, now what I want to do is an insert
into Items (above select);
The problem is that table has an addition 4 extraneous fields so as a
result I get a Column count doesn't match value count at row one.
Also, there is an autoincrement Id in that table, but I doun't think
that's an issue.
I just want to put some default or now()'s for timestamps for those
remaining values, but I am unsure how to. Please help.
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]