tag:blogger.com,1999:blog-12233913.post111373368445936738..comments2023-04-16T04:17:43.152-07:00Comments on MySQL Tips: MySQL INSERT SELECT exampleTravelTouristVideoshttp://www.blogger.com/profile/06397377314569093942noreply@blogger.comBlogger18125tag:blogger.com,1999:blog-12233913.post-10264779280175030472012-07-20T13:19:38.218-07:002012-07-20T13:19:38.218-07:00insert into blgusers-trig (id,firstname,lastname)
...insert into blgusers-trig (id,firstname,lastname)<br />won't work, because you can't use '-' in a table name.<br /><br />Change your table to blgusers_trigcomputergeniushttp://hotcosta.comnoreply@blogger.comtag:blogger.com,1999:blog-12233913.post-85746691583638626362012-05-23T17:53:06.760-07:002012-05-23T17:53:06.760-07:00how to insert data in two tables using mysql..how to insert data in two tables using mysql..Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-12233913.post-40813116587526729672012-03-30T12:03:05.927-07:002012-03-30T12:03:05.927-07:00insert into tbl_emaillist(emailId)
SELECT emailId...insert into tbl_emaillist(emailId)<br /><br />SELECT emailId FROM tbl_emaillist WHERE emailId <> 'xyz@hotmail.com'<br /><br />VALUES ('xyz@hotmail.com');Right Processorhttps://www.blogger.com/profile/14727616819672190554noreply@blogger.comtag:blogger.com,1999:blog-12233913.post-19210264120697105772011-10-12T00:10:24.745-07:002011-10-12T00:10:24.745-07:00Thnx for this SyntaxThnx for this SyntaxAbdealihttp://www.husaininc.comnoreply@blogger.comtag:blogger.com,1999:blog-12233913.post-81885300737074849912011-07-19T20:16:50.799-07:002011-07-19T20:16:50.799-07:00You can use like this
insert into blgusers-trig (...You can use like this<br /><br />insert into blgusers-trig (id,firstname,lastname) (select id,firstname,lastname from blgusers where id=2);Manivannan Nhttp://www.jobhunters.co.ccnoreply@blogger.comtag:blogger.com,1999:blog-12233913.post-8488060122624305802011-01-11T10:24:12.715-08:002011-01-11T10:24:12.715-08:00When using LIMIT I noticed a drop of 5 in the auto...When using LIMIT I noticed a drop of 5 in the auto-increment field.<br /><br />I want to insert the first 10 elements of several tables into tablenew plus another field with the a text of my choice.<br /><br />INSERT into tablenew (c1, c2, c3) SELECT a1, a2, 'list1' from table1 LIMIT 0,10<br /><br />tablenew autoincrement last record: 10<br /><br />INSERT into tablenew (c1, c2, c3) SELECT b1, b2, 'list2' from table2 LIMIT 0,10<br /><br />tablenew autoincrement next record: 16 instead of 11 !!! why?Unknownhttps://www.blogger.com/profile/06143068812708598157noreply@blogger.comtag:blogger.com,1999:blog-12233913.post-22734214330035804232010-09-21T05:47:33.241-07:002010-09-21T05:47:33.241-07:00insert into blgusers-trig (id,firstname,lastname) ...insert into blgusers-trig (id,firstname,lastname) select id,firstname,lastname from blgusers where id=2;<br /><br />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"<br /><br />both the tables have same structures. except blgusers-trig does not have id as primary key, not null and auto increment.<br /><br />let me know where is the problem in the code.<br /><br />i am using MySQL 1.2.12Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-12233913.post-51671868075128967602010-09-19T19:05:46.870-07:002010-09-19T19:05:46.870-07:00very helpfully to mevery helpfully to meAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-12233913.post-72798943405871010522010-09-03T02:32:20.582-07:002010-09-03T02:32:20.582-07:00yeahhh thankkssyeahhh thankkssAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-12233913.post-47648002664058281582010-04-13T12:13:52.160-07:002010-04-13T12:13:52.160-07:00thnx a lot. Whitetgr from Mexico Citythnx a lot. Whitetgr from Mexico CitywhiteTgrhttps://www.blogger.com/profile/01338299967061295794noreply@blogger.comtag:blogger.com,1999:blog-12233913.post-38993583952957290902010-01-09T14:15:49.497-08:002010-01-09T14:15:49.497-08:0010x, simple and effective10x, simple and effectiveserbanhttp://www.2-c.ronoreply@blogger.comtag:blogger.com,1999:blog-12233913.post-28109193568505816632010-01-06T09:29:58.144-08:002010-01-06T09:29:58.144-08:00thanx
easy & usefulthanx<br />easy & usefulUnknownhttps://www.blogger.com/profile/08321575449589894430noreply@blogger.comtag:blogger.com,1999:blog-12233913.post-17493462658886364392009-09-08T16:12:33.768-07:002009-09-08T16:12:33.768-07:00Is it possible to do this from 2 tables? Insert id...Is it possible to do this from 2 tables? Insert id from table1 select from table2Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-12233913.post-1667221387148069912009-08-05T11:00:16.086-07:002009-08-05T11:00:16.086-07:00thanks. quick but descriptive.thanks. quick but descriptive.akteniumhttp://www.aktenium.comnoreply@blogger.comtag:blogger.com,1999:blog-12233913.post-10918100440969100502009-05-28T19:16:06.872-07:002009-05-28T19:16:06.872-07:00Thanks for the script..Thanks for the script..Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-12233913.post-80452331752223448192009-02-05T02:02:00.000-08:002009-02-05T02:02:00.000-08:00When I've not done any MySql for a while I forget ...When I've not done any MySql for a while I forget the syntax. Thanks for this. <BR/><BR/>BTW - Cool idea for a blog \ code library!Fordyhttps://www.blogger.com/profile/10315620009736710724noreply@blogger.comtag:blogger.com,1999:blog-12233913.post-44641831626300329912009-02-05T02:00:00.000-08:002009-02-05T02:00:00.000-08:00When I've not done any MySql for a while I forget ...When I've not done any MySql for a while I forget the syntax. Thanks for this. <BR/><BR/>BTW - Cool idea for a blog \ code library!Fordyhttps://www.blogger.com/profile/10315620009736710724noreply@blogger.comtag:blogger.com,1999:blog-12233913.post-11872784940965654892009-02-04T23:09:00.000-08:002009-02-04T23:09:00.000-08:00thanks, i was looking for this syntax.thanks, i was looking for this syntax.Anonymousnoreply@blogger.com