INSERT ... SELECT ON DUPLICATE

2009-09-24 Thread dbrb2002-sql
Does anyone know if I can add a hint SQL_BUFFER_RESULT to INSERT .. SELECT ON DUPLICATE ex.. INSERT INTO foo SELECT SQL_BUFFER_RESULT* FROM bar ON DUPLICATE KEY UPDATE foo.X=.. Both my tables foo and bar are InnoDB; but the idea is to release the lock on bar as soon as possible by moving

Re: Wierd INSERT ... SELECT syntax problem

2008-09-06 Thread Brent Baisley
set - here is an example (the real one is more complex than this) LOC DATA - A 1 B 2 C 3 D 4 E 5 F 6 ... and I am looking to run some sort of INSERT ... SELECT on this to make a new table like this: LOC DATA - A0

Re: Wierd INSERT ... SELECT syntax problem

2008-09-06 Thread Dan Tappin
2 C3 D4 E5 F6 ... and I am looking to run some sort of INSERT ... SELECT on this to make a new table like this: LOCDATA - A010 A111 A212 A313 B020 B121 B222 B323 C030 C131 C232 C333 D040 D141 D242 D3

Wierd INSERT ... SELECT syntax problem

2008-09-05 Thread Dan Tappin
I have an existing data set - here is an example (the real one is more complex than this) LOC DATA - A 1 B 2 C 3 D 4 E 5 F 6 ... and I am looking to run some sort of INSERT ... SELECT on this to make a new table like this: LOC

Re: Insert ... select ... On Duplicate Update Question

2008-07-21 Thread mos
At 08:23 PM 7/20/2008, Perrin Harkins wrote: On Sun, Jul 20, 2008 at 12:12 AM, mos [EMAIL PROTECTED] wrote: Is there a way to get Insert ... select ... On Duplicate Update to update the row with the duplicate key? That's what it does. Why can't it do this? What makes you think it can't

Re: Insert ... select ... On Duplicate Update Question

2008-07-21 Thread Perrin Harkins
On Mon, Jul 21, 2008 at 11:44 AM, mos [EMAIL PROTECTED] wrote: I can't specify all of the columns in a Set statement in the OnDuplicate clause because I don't know what the column names are and there could be 100 columns. Write code to do it. There is no way around specifying the

Re: Insert ... select ... On Duplicate Update Question

2008-07-21 Thread mos
At 11:00 AM 7/21/2008, Perrin Harkins wrote: On Mon, Jul 21, 2008 at 11:44 AM, mos [EMAIL PROTECTED] wrote: I can't specify all of the columns in a Set statement in the OnDuplicate clause because I don't know what the column names are and there could be 100 columns. Write code to do

Re: Insert ... select ... On Duplicate Update Question

2008-07-21 Thread Phil
Insert ... select ... On Duplicate Update to update the row with the duplicate key? That's what it does. Why can't it do this? What makes you think it can't? - Perrin Perrin, I can't specify all of the columns in a Set statement in the OnDuplicate clause because I don't know what

Re: Insert ... select ... On Duplicate Update Question

2008-07-21 Thread mos
, Jul 21, 2008 at 11:44 AM, mos mailto:[EMAIL PROTECTED][EMAIL PROTECTED] wrote: At 08:23 PM 7/20/2008, Perrin Harkins wrote: On Sun, Jul 20, 2008 at 12:12 AM, mos mailto:[EMAIL PROTECTED][EMAIL PROTECTED] wrote: Is there a way to get Insert ... select ... On Duplicate Update to update the row

Re: Insert ... select ... On Duplicate Update Question

2008-07-21 Thread Perrin Harkins
On Mon, Jul 21, 2008 at 2:43 PM, mos [EMAIL PROTECTED] wrote: I thought if MySQL found a duplicate key on the insert, it would automatically update the existing row that it found with the results from table1 if I left out the column expressions in the update clause. But apparently it doesn't

Re: Insert ... select ... On Duplicate Update Question

2008-07-20 Thread Perrin Harkins
On Sun, Jul 20, 2008 at 12:12 AM, mos [EMAIL PROTECTED] wrote: Is there a way to get Insert ... select ... On Duplicate Update to update the row with the duplicate key? That's what it does. Why can't it do this? What makes you think it can't? - Perrin -- MySQL General Mailing List

Insert ... select ... On Duplicate Update Question

2008-07-19 Thread mos
Is there a way to get Insert ... select ... On Duplicate Update to update the row with the duplicate key? Otherwise I'll have to use Replace which is inefficient because it deletes the old duplicated row and then inserts the new row with the same key. I'd much rather have it update

Insert ... select

2008-05-06 Thread Daniel Wood
Hi all, Apologies if this isn't the correct list but I couldn't see a more suitable one. I have 4 tables. t1 and t3 are a many to many relationship and use t2 as link table. t3 has many t4. What I want to do is insert a new row into t3 for each row in t1. I then want to add the

Re: insert select

2008-04-04 Thread Hiep Nguyen
On Thu, 3 Apr 2008, Hiep Nguyen wrote: hi all, i have a question on insert ... select statement. tbl_1(fld1,fld2,fld3, ) fld1 int primary key auto_increment not null tbl_2(fld_a,fld_b,fld_c,...) how do i construct my select statement so that fld1 is auto increment? insert into tbl_1

insert select

2008-04-03 Thread Hiep Nguyen
hi all, i have a question on insert ... select statement. tbl_1(fld1,fld2,fld3, ) fld1 int primary key auto_increment not null tbl_2(fld_a,fld_b,fld_c,...) how do i construct my select statement so that fld1 is auto increment? insert into tbl_1(fld1,fld2,fld3) select xxx, fld_b, NOW

Re: insert select

2008-04-03 Thread Johan Höök
Hi Hiep, you can put in either xxx = NULL or you can skip it completely: insert into tbl_1(fld2,fld3) select fld_b, NOW() from tbl_2; Regards, /Johan Hiep Nguyen skrev: hi all, i have a question on insert ... select statement. tbl_1(fld1,fld2,fld3, ) fld1 int primary key

Re: insert select

2008-04-03 Thread Hiep Nguyen
On Thu, 3 Apr 2008, Johan Höök wrote: Hi Hiep, you can put in either xxx = NULL or you can skip it completely: insert into tbl_1(fld2,fld3) select fld_b, NOW() from tbl_2; Regards, /Johan Hiep Nguyen skrev: hi all, i have a question on insert ... select statement. tbl_1(fld1,fld2

Re: insert select

2008-04-03 Thread Johan Höök
Hi Hiep, Hiep Nguyen skrev: On Thu, 3 Apr 2008, Johan Höök wrote: Hi Hiep, you can put in either xxx = NULL or you can skip it completely: insert into tbl_1(fld2,fld3) select fld_b, NOW() from tbl_2; Regards, /Johan Hiep Nguyen skrev: hi all, i have a question on insert ... select

Re: insert select

2008-04-03 Thread Arthur Fuller
, 2008 at 10:37 AM, Johan Höök [EMAIL PROTECTED] wrote: Hi Hiep, you can put in either xxx = NULL or you can skip it completely: insert into tbl_1(fld2,fld3) select fld_b, NOW() from tbl_2; Regards, /Johan Hiep Nguyen skrev: hi all, i have a question on insert ... select

Insert Select query problem

2007-08-10 Thread Ed Reed
Into `request` (Required, Qty) Values ('Apples', 12), ('Bananas', 112), ('Cherries', 5); Now what I*d like to do is create a single Insert Select query that creates a record in my purchase table for each of the items in my request table based on the number of items available in my inventory

Re: Insert Select query problem

2007-08-10 Thread Jay Pipes
), ('Cherries',6); Insert Into `request` (Required, Qty) Values ('Apples', 12), ('Bananas', 112), ('Cherries', 5); Now what I*d like to do is create a single Insert Select query that creates a record in my purchase table for each of the items in my request table based on the number of items available

Re: Insert Select query problem

2007-08-10 Thread Ed Reed
); Insert Into `request` (Required, Qty) Values ('Apples', 12), ('Bananas', 112), ('Cherries', 5); Now what I*d like to do is create a single Insert Select query that creates a record in my purchase table for each of the items in my request table based on the number of items available in my

last insert ids from insert select

2007-06-22 Thread Ezequiel Panepucci
Dear All, I've just posted this to MySQLdb help forum but maybe there is a mysql way of getting what I want and you could, time permitting, help me. First my setup: * Python 2.5 * MySQL 5.0.27-standard-log (MYISAM tables) * MySQLdb.version_info (1, 2, 2, 'gamma', 1) I have the following

INSERT ... SELECT Challenge

2007-03-12 Thread Miles Thompson
I want to add records to an attributes table for every item which does not have an attribute of a given value. The problem is that some records have already had these values added. Please have a look at the following query, an INSERT ... SELECT construct which I believe will do the job

Re: INSERT ... SELECT Challenge

2007-03-12 Thread Brent Baisley
[EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: Monday, March 12, 2007 3:02 PM Subject: INSERT ... SELECT Challenge I want to add records to an attributes table for every item which does not have an attribute of a given value. The problem is that some records have already had these values added

Re: INSERT ... SELECT Challenge

2007-03-12 Thread Miles Thompson
. The index will prevent a new non-unique from being entered and the IGNORE will prevent an error. - Original Message - From: Miles Thompson [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: Monday, March 12, 2007 3:02 PM Subject: INSERT ... SELECT Challenge I want to add records

Re: INSERT ... SELECT Challenge

2007-03-12 Thread Miles Thompson
. The index will prevent a new non-unique from being entered and the IGNORE will prevent an error. - Original Message - From: Miles Thompson [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: Monday, March 12, 2007 3:02 PM Subject: INSERT ... SELECT Challenge I want to add records

SET @var and insert that as cunting var into table with insert select

2007-02-02 Thread Barry
that? I think it works somehow with SET @maxid = @maxid +1 But i fail combining it with INSERT SELECT :/ Any help is greatly appriciated =) My best wishes Barry -- Smileys rule (cX.x)C --o(^_^o) Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o) -- MySQL General Mailing List For list

Re: SET @var and insert that as cunting var into table with insert select

2007-02-02 Thread Barry
Barry schrieb: Hello Everyone! i forgot i am using MySQL 4.11 Greetings Barry -- Smileys rule (cX.x)C --o(^_^o) Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:

Re: SET @var and insert that as cunting var into table with insert select

2007-02-02 Thread Dušan Pavlica
Barry napsal(a): Hello Everyone! I am having a big problem with counting inserting rows. This is my Query: SELECT MAX(id) INTO @maxid FROM table1; // @maxid is now 44 INSERT INTO table2 (orderid, someothervars) SELECT @maxid +1, blahvar FROM table3; try select @maxid:=max(id)-1 from

Re: Insert ... Select troubles

2007-01-16 Thread Ed Reed
assumed those two field were your primary key. The way I described in the easiest way to implement it. Especially since you can do future insert/select without having to worry about figureing out sequence numbers for each group. You may want to think if you need two unique indexes. Obviously if you

Re: Insert ... Select troubles

2007-01-15 Thread Brent Baisley
When you said multiple field unique key, I assumed those two field were your primary key. The way I described in the easiest way to implement it. Especially since you can do future insert/select without having to worry about figureing out sequence numbers for each group. You may want to think

Re: Insert ... Select troubles

2007-01-12 Thread Ed Reed
ItemCount is essentially a counter of the records from the select statement. So, every new INSERT ... SELECT statement gets a new GroupCount (the next number up) and ItemCount represents the ID of the items in that new group. Does that make sense? - Thanks Michael Dykman [EMAIL PROTECTED] 1

Re: Insert ... Select troubles

2007-01-12 Thread Brent Baisley
to be made for each record group. - Original Message - From: Ed Reed [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: Friday, January 12, 2007 12:42 PM Subject: Re: Insert ... Select troubles ItemCount is essentially a counter of the records from the select statement. So, every new INSERT

Re: Insert ... Select troubles

2007-01-12 Thread Ed Reed
record group. - Original Message - From: Ed Reed [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: Friday, January 12, 2007 12:42 PM Subject: Re: Insert ... Select troubles ItemCount is essentially a counter of the records from the select statement. So, every new INSERT ... SELECT

Insert ... Select troubles

2007-01-11 Thread Ed Reed
I need some help creating an INSERT * SELECT statement that supplies a record counter in the returned items. Here's the task, I have t1 and t2. t1 is GroupCount, ItemCount, Field1, Field2, Field3. t2 is Field1, Field2, Field3. t1 has a multiple field unique key called Request that has

Insert ... Select Max() .. transactional Query optimization on an InnoDB table

2006-08-10 Thread Asif Lodhi
Hi, Using MySQL-5.0.22/Win-XP-SP2 and storing data in InnoDB tables. Clients connect from VB6. Enclosing all transactions in START TRANSACTION ... COMMIT statements from VB6 clients. I have the following query for a table tmp2 with a column x of data-type INT. Insert into tmp2(x,y,x)

Insert Select problem

2006-05-04 Thread Barry
I get this error: Fehler in /home/virtual/site4/fst/var/www/html/adminheaven/artikel-vererben-save.php in Zeile 36 mit Error:br Query:INSERT INTO objektflyer_verknuepfung (av_o_id_haupt,av_o_id_link,av_text,av_op_id) SELECT 418,av_o_id_link,av_text,av_op_id FROM objektflyer_verknuepfung WHERE

Re: Insert Select problem

2006-05-04 Thread Johan Höök
Hi Barry, see: http://dev.mysql.com/doc/refman/5.0/en/insert-select.html you cannot insert into a table you're doing select on (same goes for update). Regards, /Johan Barry skrev: I get this error: Fehler in /home/virtual/site4/fst/var/www/html/adminheaven/artikel-vererben-save.php

Re: Insert Select problem

2006-05-04 Thread Barry
Johan Höök schrieb: Hi Barry, see: http://dev.mysql.com/doc/refman/5.0/en/insert-select.html you cannot insert into a table you're doing select on (same goes for update). But i am doing it on a test server version 5.x and it works like a charm :) -- Smileys rule (cX.x)C --o(^_^o) Dance for

INSERT...SELECT Query Help Request.

2006-03-22 Thread Yesmin Patwary
master_list and child_list table structure are identical but data in child_list may contain records from master_list and new records. I have constructed query using INSERT…SELECT but I am unable to check and filter out records that already exist in master_list. INSERT INTO master_list

Re: INSERT...SELECT Query Help Request.

2006-03-22 Thread SGreen
only non existent records in master_list from a child_list. Both master_list and child_list table structure are identical but data in child_list may contain records from master_list and new records. I have constructed query using INSERT…SELECT but I am unable to check and filter out

INSERT SELECT Problem

2005-11-23 Thread Shaun
Hi, The following query worked fine: INSERT INTO Allocations(Project_ID, User_ID) SELECT P.Project_ID, U.User_ID FROM Users U, Projects P, Clients C WHERE P.Client_ID = C.Client_ID AND U.Client_ID = C.Client_ID AND Project_ID =.$project_id) However I want to add a column to the INSERT part of

RE: INSERT SELECT Problem

2005-11-23 Thread Almar van Pel \(Koekjes.Net\)
) Met vriendelijke groet, Almar van Pel -Oorspronkelijk bericht- Van: Shaun [mailto:[EMAIL PROTECTED] Verzonden: woensdag 23 november 2005 15:22 Aan: mysql@lists.mysql.com Onderwerp: INSERT SELECT Problem Hi, The following query worked fine: INSERT INTO Allocations(Project_ID, User_ID

Re: INSERT SELECT Problem

2005-11-23 Thread Diego Ignacio Wald
YES_COLUMN with the column name that stores the 'Yes' values. Best regards, Diego Wald - Original Message - From: Shaun [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: Wednesday, November 23, 2005 11:21 AM Subject: INSERT SELECT Problem Hi, The following query worked fine: INSERT

INSERT SELECT

2005-09-12 Thread Shaun
Hi, I have four tables: Projects, Users, Allocations and Clients. A Client will have many projects and many Users, Users are allocated to Projects via a link table - Allocations. When I add a project I want to have an option of allocating all users to the project, can this be done with a

Re: INSERT SELECT

2005-09-12 Thread Shaun
Sorry guys, Worked it out, if anyone is interested here is the query: INSERT INTO Allocations(Project_ID, User_ID) SELECT P.Project_ID, U.User_ID FROM Users U, Projects P, Clients C WHERE P.Client_ID = C.Client_ID AND U.Client_ID = C.Client_ID AND Project_ID = 2 Shaun [EMAIL PROTECTED] wrote in

re: could insert...select have problem with corrupt table

2005-09-01 Thread James Black
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Today mysql 4.1.8 has a segmentation fault (signal 11), and crashed. In the process one table was left corrupted, when it started back up. An application continued to call insert...select on the corrupted table as it wasn't realized this happened

insert...select only inserts first record

2005-05-11 Thread Andy Pieters
Hi all I want to 'copy' the contents of the table 'cart', where userid=... to the table pending_cart. Here is some example data for the table 'cart' ++++-+ | id | userid | prodid | qty | ++++-+ | 25 |123 | 15 | 1 | | 23 |124 | 14

Re: insert...select only inserts first record

2005-05-11 Thread SGreen
released under the GPL2 and that are meant for use with a php cli binary: http://www.vlaamse-kern.com/sas/ -- -- [attachment attfzmu4.dat deleted by Shawn Green/Unimin] This is what you posted as the results of your test INSERT...SELECT. Look at it again (carefully this time): Query OK

Re: insert...select only inserts first record [SOLVED]

2005-05-11 Thread Andy Pieters
Hi I got a reply offlist from Shawn Green telling me to check my indexes on table pending_cart. As it turned out, the primary index (id) did not have its auto_increment bit set. ALTER TABLE `pending_cart` CHANGE `id` `id` INT( 11 ) DEFAULT '0' NOT NULL

construct table for fast insert/select

2005-03-28 Thread Grace Dongfang
Hi, I have tables with only 2 fields, key (char(30)) and value(blob), the value is about 2K. The table is going to store more than 20 million entries. I will keep inserting, selecting and deleting the table. I wonder what will the best way be to construct table, i.e., how should I do

Re: insert - select from two different applications race condition?

2005-03-12 Thread Rhino
- Original Message - From: Aragorn [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: Saturday, March 12, 2005 1:47 AM Subject: insert - select from two different applications race condition? I have a simple problem... I'm using mysql 4.1.9/innodb table and two small python

insert - select from two different applications race condition?

2005-03-11 Thread Aragorn
I have a simple problem... I'm using mysql 4.1.9/innodb table and two small python applications A and B first application A is executed, and do a simple INSERT into a table then application B is executed: - B does a SELECT in the same table, that should return the entry created by application A

Re: INSERT .. SELECT ... ON DUPLICATE KEY UPDATE

2005-02-27 Thread Tom Cunningham
Thanks Shawn, Sergei. I'll get onto the new version as soon as I can. Tom. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Re: INSERT .. SELECT ... ON DUPLICATE KEY UPDATE

2005-02-25 Thread Sergei Golubchik
Hi! On Feb 24, Tom Cunningham wrote: It appears you can't combine an insert-select with an on-duplicate-key-update. You can, since 4.1.10 (and there're some problems with name resolution there, so better wait for 4.1.11 - search bugdb for details) Regards, Sergei

INSERT .. SELECT ... ON DUPLICATE KEY UPDATE

2005-02-24 Thread Tom Cunningham
It appears you can't combine an insert-select with an on-duplicate-key-update. I would find it very useful if you *could* do this. I know it would be complicate how you would handle the syntax for what to do when you hit a duplicate key, could do this: update all the columns

Re: INSERT .. SELECT ... ON DUPLICATE KEY UPDATE

2005-02-24 Thread SGreen
Tom Cunningham [EMAIL PROTECTED] wrote on 02/24/2005 11:31:31 AM: It appears you can't combine an insert-select with an on-duplicate-key-update. I would find it very useful if you *could* do this. I know it would be complicate how you would handle the syntax for what to do when you hit

insert...select with auto increment

2005-02-15 Thread steve cooley
How do you you get the next auto increment value? I think I'm running into the insert...select problem. I want to duplicate records from one table to the _same_ table, with an incremented auto increment value. Can I do something like this: insert into table (autoincrement_key, field1, field2

Re: insert...select with auto increment

2005-02-15 Thread Michael Dykman
On Tue, 2005-02-15 at 17:56, steve cooley wrote: How do you you get the next auto increment value? I think I'm running into the insert...select problem. I want to duplicate records from one table to the _same_ table, with an incremented auto increment value. Can I do something like

INSERT ... SELECT statement

2005-01-21 Thread Stefano Giorgetti
I need to execute an INSERT...SELECT query. INSERT HIGH_PRIORITY INTO stations_data (station_id, Tmin, Tmax, Tmed, RHmin, RHmax, RHmed, rain, Wmax, slpres, insertion_date) ( SELECT stations.station_id AS stId, min(stations_rt_data.T) AS tmax

INSERT SELECT in older version of MySQL

2004-10-15 Thread Jay Blanchard
mysql INSERT INTO Employee.tblNiiEmployee (empEmail) - SELECT b.Email_Address - FROM Employee.tblNiiEmployee a LEFT OUTER JOIN UserDB.Corporate b - ON(a.empUsrName = b.Unix_Username) - WHERE b.Email_Address IS NOT NULL; Since versions prior to 4.0.14 do not support using the same

RE: INSERT SELECT in older version of MySQL SOLVED

2004-10-15 Thread Jay Blanchard
[snip] mysql INSERT INTO Employee.tblNiiEmployee (empEmail) - SELECT b.Email_Address - FROM Employee.tblNiiEmployee a LEFT OUTER JOIN UserDB.Corporate b - ON(a.empUsrName = b.Unix_Username) - WHERE b.Email_Address IS NOT NULL; Since versions prior to 4.0.14 do not support using

insert/select for multiple tables...

2004-09-01 Thread bruce
hi... trying to figure out how to structure an insert/select for a multiple table situation... sort of... insert table1, table2 (table1.item1, table1.item2, table2.item1,...) select a.q1, b.q2 from a1 left join a2 on a2.t=a1.t where a2.r='4'; i can't seem to figure out the syntax

Re: insert/select for multiple tables...

2004-09-01 Thread Michael Stassen
bruce wrote: hi... trying to figure out how to structure an insert/select for a multiple table situation... sort of... insert table1, table2 (table1.item1, table1.item2, table2.item1,...) select a.q1, b.q2 from a1 left join a2 on a2.t=a1.t where a2.r='4'; i can't seem to figure out

RE: insert/select for multiple tables...

2004-09-01 Thread bruce
, September 01, 2004 10:06 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: insert/select for multiple tables... bruce wrote: hi... trying to figure out how to structure an insert/select for a multiple table situation... sort of... insert table1, table2 (table1.item1, table1

RE: insert/select for multiple tables...

2004-09-01 Thread Paul DuBois
At 10:52 -0700 9/1/04, bruce wrote: michael... it was meant as an example, to convey what i want to do, which is do a simltaneaous insert into multiple tables at the same time. the syntax concerning the left join/elements to be inserted was not intended to be syntacticly (sp?) correct!!! and as i

Re: insert/select for multiple tables...

2004-09-01 Thread Michael Stassen
to you now... -regards -Original Message- From: Michael Stassen [mailto:[EMAIL PROTECTED] bruce wrote: hi... trying to figure out how to structure an insert/select for a multiple table situation... sort of... insert table1, table2 (table1.item1, table1.item2, table2.item1,...) select

another insert/select for multiple tables... (or, determining previous auto-increment ID)

2004-09-01 Thread Eve Atley
The question: Is there anything in MySQL that will allow me to determine, accurately, the last auto-incremented field from a particular database, so I can then insert based upon this into another table? What if 2 users input at the same time? Please see the 'long explanation' for further

Re: another insert/select for multiple tables... (or, determining previous auto-increment ID)

2004-09-01 Thread SGreen
Since you should still have the same information that you used to create your entry in the candidate table you can do something like: SELECT @candidateID := Candidate_ID FROM candidate WHERE Last_Name = '$lastname' AND First_Name = '$firstname' AND Middle_Initial = '$middle'

Re: another insert/select for multiple tables... (or, determining previous auto-increment ID)

2004-09-01 Thread Michael Stassen
Yes, LAST_INSERt_ID(). It's connection-specific, not db-specific. Because it is connection-specific, your 2-users issue is avoided. See the manual for the details http://dev.mysql.com/doc/mysql/en/Getting_unique_ID.html. Michael Eve Atley wrote: The question: Is there anything in MySQL that

INSERT SELECT

2004-07-07 Thread shaun thornburgh
Hi, Using the following query I am attampting to insert the Work_Type_IDs from Work_Types WHERE Project_ID = 'x'. However I also wan to insert the Project_ID into the table, how would this syntax work - apperently the column count is incorrect... INSERT INTO Letter_Templates (Work_Type_ID,

RE: INSERT SELECT

2004-07-07 Thread Andy Eastham
thornburgh [mailto:[EMAIL PROTECTED] Sent: 07 July 2004 13:37 To: [EMAIL PROTECTED] Subject: INSERT SELECT Hi, Using the following query I am attampting to insert the Work_Type_IDs from Work_Types WHERE Project_ID = 'x'. However I also wan to insert the Project_ID into the table, how

Insert .. select problem.

2004-06-02 Thread Santino
Hello , I'm working on a project with MySql 4.0.12-log. I have a problem with insert .. select: To describe the program of some touristic tours I create two tables: TOUR that contains the data TAPPE that contains the program of the tour. (relation 1:n). To keep track of each tour i create two

INSERT ... SELECT question

2004-03-29 Thread Eric J. Janus
I have a table with just about 100 columns, and I would like to duplicate a row exactly, except for one column, which is the AUTO_INCREMENT column. Using 'INSERT INTO tbl_name SELECT * FROM tbl_name WHERE id_col = 1' doesn't work, because it produces the following error: 'ERROR 1062: Duplicate

RE: INSERT ... SELECT question

2004-03-29 Thread Matt Chatterley
, col2, col3: INSERT INTO table (col2, col3) SELECT col2, col3 FROM table2 WHERE id_col=1; Regards, Matt -Original Message- From: Eric J. Janus [mailto:[EMAIL PROTECTED] Sent: 29 March 2004 19:37 To: MySQL Subject: INSERT ... SELECT question I have a table with just about 100 columns

RE: INSERT ... SELECT question

2004-03-29 Thread Eric J. Janus
was hoping that MySQL had something built in to make this easier. Thanks, Eric -Original Message- From: Matt Chatterley [mailto:[EMAIL PROTECTED] Sent: Monday, March 29, 2004 2:11 PM To: 'Eric J. Janus'; 'MySQL' Subject: RE: INSERT ... SELECT question Importance: Low Can you

RE: INSERT ... SELECT question

2004-03-29 Thread Matt Chatterley
: INSERT ... SELECT question There is only 1 table. I want to replicate a record in a table except the AUTO_INCREMENT column. Your solution would work, but I'd prefer to not have to maintain a list of columns in the application. Worst case I'll have the application generate the query based

RE: INSERT ... SELECT question

2004-03-29 Thread Eric J. Janus
, March 29, 2004 2:25 PM To: 'Eric J. Janus'; 'MySQL' Subject: RE: INSERT ... SELECT question Importance: Low Oh, if only there were views!! That would make this easy. Maybe soon (*please*). :) Another approach (more cumbersome) might be to insert the rows you need to duplicate into a temporary

RE: INSERT ... SELECT question

2004-03-29 Thread Henrik Schröder
an appropriate where-clause to the above statement. /Henrik -Original Message- From: Eric J. Janus [mailto:[EMAIL PROTECTED] Sent: den 29 mars 2004 21:28 To: Matt Chatterley; 'MySQL' Subject: RE: INSERT ... SELECT question Views would be nice. :) That idea sounds like it would work

RE: INSERT ... SELECT question

2004-03-29 Thread Eric J. Janus
the application everytime I change the table, which I don't always want to do. -Original Message- From: Henrik Schröder [mailto:[EMAIL PROTECTED] Sent: Monday, March 29, 2004 3:07 PM To: 'Eric J. Janus'; 'MySQL' Subject: RE: INSERT ... SELECT question Importance: Low

Re: How could I do this insert/select?

2004-03-16 Thread Egor Egorov
stephen [EMAIL PROTECTED] wrote: mysql use zzz Database changed mysql create table category - ( - id tinyint(4) NOT NULL auto_increment, - name varchar(20) NOT NULL, - parent tinyint(4) NULL, - primary key(id) - ); Query OK, 0 rows affected (0.00

How could I do this insert/select?

2004-03-15 Thread stephen
Hi, How could I do this insert/select? create table category ( id tinyint(4) NOT NULL auto_increment, name varchar(20) NOT NULL, parent tinyint(4) NULL, primary key(id) ); insert into category (name, parent) values('cc_1',null); insert into category (name, parent) select 'cc_2a

Re: How could I do this insert/select?

2004-03-15 Thread cvarda
-- excerpt -- []s, Conrado - Original Message - From: stephen [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, March 16, 2004 2:57 AM Subject: How could I do this insert/select? Hi, How could I do this insert/select? create table category

Re: How could I do this insert/select?

2004-03-15 Thread stephen
[EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, March 15, 2004 10:57 PM Subject: Re: How could I do this insert/select? It seems to work on my MySQL (4.0.18). Tell us which version are you using and the error code/message returned. -- excerpt

Working around Insert ... Select

2004-03-02 Thread Boyd E. Hemphill
Hello to all: I am attempting to move two columns of data into a large table by using the insert into . select . construct. My problem is that I need to join to the table I am inserting to. To get around this my idea is to create a temporary database and populate it with the table then join

Re: Working around Insert ... Select

2004-03-02 Thread Michael Stassen
Perhaps I'm misunderstanding what you want, but could you create your temporary table as the result of your construct, then insert it into your table? If I'm reading you correctly, I think that would involve less data in the temporary table, so might be faster overall. Something like:

Re: Working around Insert ... Select

2004-03-02 Thread Egor Egorov
Boyd E. Hemphill [EMAIL PROTECTED] wrote: I am attempting to move two columns of data into a large table by using the insert into . select . construct. My problem is that I need to join to the table I am inserting to. To get around this my idea is to create a temporary database and populate

Is INSERT...SELECT atomic? [REPOST]

2004-01-30 Thread Allon Bendavid
Does anyone know this? In the 4.0.17 and later build, the target table of an INSERT...SELECT can be the same as the SELECT table (insert into table1...select ...from table1). Does the process essentially happen in a natural lock? In other words, could the table change between the data retrieved

Is INSERT...SELECT atomic?

2004-01-29 Thread Allon Bendavid
In the 4.0.17 and later build, the target table of an INSERT...SELECT can be the same as the SELECT table (insert into table1...select ...from table1). Does the process essentially happen in a natural lock? In other words, could the table change between the data retrieved in the select

Re: Insert select query problem

2003-11-14 Thread Victoria Reznichenko
Luis Lebron [EMAIL PROTECTED] wrote: I am try to copy a couple of fields from one table to another. Here is my query Insert into users_test (firstName, lastName) Select firstName, lastName from users; The users table has 1,263 rows. However, only 1 row is inserted into users_test.

Insert select query problem

2003-11-13 Thread Luis Lebron
I am try to copy a couple of fields from one table to another. Here is my query Insert into users_test (firstName, lastName) Select firstName, lastName from users; The users table has 1,263 rows. However, only 1 row is inserted into users_test. If I perform the following query Insert into

Re: another insert select question

2003-11-05 Thread Egor Egorov
? If I've got you right you need UPDATE, not INSERT .. SELECT. UPDATE webuser, employees SET webuser.userid=employees.email WHERE webuser.idnumber=employees.idnumber; The above UPDATE statement will work from v4.0.4. -- For technical support contracts, goto https://order.mysql.com/?ref=ensita

Re: another insert select question

2003-11-05 Thread Jason Joines
? If I've got you right you need UPDATE, not INSERT .. SELECT. UPDATE webuser, employees SET webuser.userid=employees.email WHERE webuser.idnumber=employees.idnumber; The above UPDATE statement will work from v4.0.4. You've got it right, I was way off trying to use an INSERT instead of an UPDATE

Re: another insert select question

2003-11-05 Thread Jason Joines
in the webusers table? If I've got you right you need UPDATE, not INSERT .. SELECT. UPDATE webuser, employees SET webuser.userid=employees.email WHERE webuser.idnumber=employees.idnumber; The above UPDATE statement will work from v4.0.4. You've got it right, I was way off trying to use an INSERT

another insert select question

2003-11-04 Thread Jason Joines
Table employees: | idnumber | email | phone | address | Table webusers: - | idnumber | userid | website | - Table employees is completely populated. Table

Re: Insert ... Select question

2003-10-29 Thread
I use this syntax but I have privilege problem. Thenk you anyway - Original Message - From: Nitin [EMAIL PROTECTED] To: IEEIO AAOOCO [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, October 27, 2003 5:20 PM Subject: Re: Insert ... Select question of course, the syntax is: insert

Insert ... Select question

2003-10-27 Thread
Hello list I want to insert ... select data from table1 of db1 to table2 of db3. Is that possible? Thank in advance -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Re: Insert ... Select question

2003-10-27 Thread Nitin
27, 2003 8:28 PM Subject: Insert ... Select question Hello list I want to insert ... select data from table1 of db1 to table2 of db3. Is that possible? Thank in advance -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com

RE: Insert ... Select question

2003-10-27 Thread Fortuno, Adam
... Select question Hello list I want to insert ... select data from table1 of db1 to table2 of db3. Is that possible? Thank in advance -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General

  1   2   >