Snippets of MySQL tips, solutions, examples, tutorials, and even benchmarks
thanks, i was looking for this syntax.
When I've not done any MySql for a while I forget the syntax. Thanks for this. BTW - Cool idea for a blog \ code library!
Thanks for the script..
thanks. quick but descriptive.
Is it possible to do this from 2 tables? Insert id from table1 select from table2
thanxeasy & useful
10x, simple and effective
thnx a lot. Whitetgr from Mexico City
very helpfully to me
insert into blgusers-trig (id,firstname,lastname) select id,firstname,lastname from blgusers where id=2;i am trying this.. but i am getting an error as "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-trig (id,firstname,lastname) select id,firstname,lastname from blgusers where i' at line 1"both the tables have same structures. except blgusers-trig does not have id as primary key, not null and auto increment.let me know where is the problem in the code.i am using MySQL 1.2.12
When using LIMIT I noticed a drop of 5 in the auto-increment field.I want to insert the first 10 elements of several tables into tablenew plus another field with the a text of my choice.INSERT into tablenew (c1, c2, c3) SELECT a1, a2, 'list1' from table1 LIMIT 0,10tablenew autoincrement last record: 10INSERT into tablenew (c1, c2, c3) SELECT b1, b2, 'list2' from table2 LIMIT 0,10tablenew autoincrement next record: 16 instead of 11 !!! why?
You can use like thisinsert into blgusers-trig (id,firstname,lastname) (select id,firstname,lastname from blgusers where id=2);
Thnx for this Syntax
insert into tbl_emaillist(emailId)SELECT emailId FROM tbl_emaillist WHERE emailId <> 'email@example.com'VALUES ('firstname.lastname@example.org');
how to insert data in two tables using mysql..
insert into blgusers-trig (id,firstname,lastname)won't work, because you can't use '-' in a table name.Change your table to blgusers_trig
Post a Comment