Update Syntax

2009-07-26 Thread Victor Subervi
Hi; I would like to test the following: update maps set map where site=mysite; to see if there is such an entry in maps. If there is, then update. If there is not, then I would like to execute an insert statement. How do I do that? TIA, Victor

RE: Update email address domain

2009-06-29 Thread John Furlong
Nathan, That was exactly what I was looking for, thanks for your help. John -Original Message- From: Nathan Sullivan [mailto:nsulli...@cappex.com] Sent: Monday, June 29, 2009 2:55 PM To: John Furlong; mysql@lists.mysql.com Subject: RE: Update email address domain John, I think this

RE: Update email address domain

2009-06-29 Thread Nathan Sullivan
John, I think this should work: UPDATE members SET email=REPLACE(email, SUBSTRING(email,INSTR(email,'@')+1), 'Thanks_in_advance.com.com') Regards, Nathan -Original Message- From: John Furlong [mailto:john.furl...@rakutenusa.com] Sent: Monday, June 29, 200

Update email address domain

2009-06-29 Thread John Furlong
I'm trying to mask the email addresses for a development database. I need to make all of the domains exactly the same. What is the best way to do this? We have about 67000 distinct domains. I was able to use substring to get the list of domains, but am not sure how to turn that into an u

Replication problems: slave fails to update

2009-06-02 Thread Proemial
I'm trying to resolve a frustrating replication problem with my databases. The master contains a number of schema, only using Innodb tables. Updates happen regularly, usually using bulk inserts of the form INSERT ... ON DUPLICATE UPDATE. Data is mostly numbers. The missing queries conta

Re: Update with value form another table

2009-05-22 Thread Perrin Harkins
On Fri, May 22, 2009 at 1:22 PM, Chris W <4rfv...@cox.net> wrote: > Of course study to profile is a one to many relationship.  How do I run an > update to set  p.`Date` equal to s.`Date`? This is covered in the docs for UPDATE. Read that and come back if you're stuck. - Perrin

Update with value form another table

2009-05-22 Thread Chris W
I have a table with a date value that I need to update with a value from another table. The table I want to update is profile. The profile table is linked to the study table with the foreign key StudyID. the profile table has the date I want to update to the value in the date value in the

Re: If condition in select query / insert /update

2009-05-18 Thread bharani kumar
Can u tell me , assume if i use If in the query , then i reduce performance , Any idea On Mon, May 18, 2009 at 3:19 PM, Janek Bogucki wrote: > Hi, > > mysql> create table t(i int); > > mysql> insert into t values(1),(2),(3); > > mysql> select i, if(i <= 1, 'low', 'high') from t order by i; > +--

Re: If condition in select query / insert /update

2009-05-18 Thread Janek Bogucki
Hi, mysql> create table t(i int); mysql> insert into t values(1),(2),(3); mysql> select i, if(i <= 1, 'low', 'high') from t order by i; +--+---+ | i| if(i <= 1, 'low', 'high') | +--+---+ |1 | low | |2 | hig

If condition in select query / insert /update

2009-05-17 Thread bharani kumar
Hi all , Can u give one example query , Which contain the IF condition , Because here before am not used the IF and all , Thanks -- உங்கள் நண்பன் பரணி குமார் Regards B.S.Bharanikumar POST YOUR OPINION http://bharanikumariyerphp.site88.net/bharanikumar/

Setting auto increment value in an update statement

2009-03-31 Thread Andreas Pardeike
| NULL || +-+--+--+-+--- ++ where 'payload' size usually is quite big! Now I want to manipulate a number of rows in a non-trivial way and at the same time set 'id' for those rows to a new number in the sequence. I.e. UPDAT

Re: UPDATE ... where max(datecolumn)

2009-01-31 Thread Baron Schwartz
2005-02-18 > 222008-03-13 > 322008-11-21 > 462009-01-21 > > A field has been added for current order to this table: > > ID PRODUCT DATEORDERED FLAGCURRENT > > I need to update all records in the tabl

UPDATE ... where max(datecolumn)

2009-01-27 Thread Adria Stembridge
I have a table like this: ID PRODUCT DATEORDERED 152005-02-18 222008-03-13 322008-11-21 462009-01-21 A field has been added for current order to this table: ID PRODUCT DATEORDERED FLAGCURRENT I need to update

UPDATE: 2 MySQL DBA FULLTIME ROLES located in Westlake Village, CA and Miami Beach, FL

2009-01-24 Thread sumaklos
MySQL DBA We seek to hire a talented MySQL DBA to join our dynamic teams in California and Miami. Both roles are for onsite roles (no telecommuting). We are a well established multimedia/online dating organization focused primarily on the development of Internet media properties and is a lea

Re: UPDATE jujitsu?

2009-01-08 Thread Jim Lyons
How about this? update t set onoffflag = if (name <> 'China', onoffflag, ( if (location = 'Table', 1, 0) )); This leaves any onoffflag untouched if name is not China, which I assume you wanted to do. On Thu, Jan 8, 2009 at 2:18 PM, Christoph Boget wrote: >

UPDATE jujitsu?

2009-01-08 Thread Christoph Boget
Consider the folowing dataset: +++-+-+---+ | id| Name | Location| OnOffFlag | Description | +++-+-+---+ | 1 | Paper| Cabinet | 0 | Blah| | 2

Re: Update Problem when ORing w/ Long.MIN_VALUE

2008-11-26 Thread Daniel Doubleday
For the curious: As usual "select is not broken". Lesson learned: Always watch out for warnings: http://bugs.mysql.com/bug.php?id=41007 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Re: Update Problem when ORing w/ Long.MIN_VALUE

2008-11-25 Thread Daniel Doubleday
Hi Gautam nope yours is not a bug. That's all fine. Hex numbers are 64 bit unsigned. So for -1 you have to insert cast(0x as signed). Cheers, Daniel Hi Daniel, I can see the problem without using "update". However, I am a newbie at mysql, so can'

Re: Update Problem when ORing w/ Long.MIN_VALUE

2008-11-24 Thread Gautam Gopalakrishnan
Hi Daniel, I can see the problem without using "update". However, I am a newbie at mysql, so can't say for certain if it's a bug: mysql> drop table if exists foo; mysql> create table foo (id int signed, val bigint signed); mysql> insert into foo values (0xf

Update Problem when ORing w/ Long.MIN_VALUE

2008-11-24 Thread Daniel Doubleday
Hi everybody - I'm experiencing some really weird update behaviour (mysql 5.0) when or'ing results from subselects using Long.MIN_VALUE. But before I post a bug report I wanted to ask if I'm missing something. drop table if exists foo; drop table if exists bar; create table

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

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

2008-07-21 Thread mos
rows then a Replace will work fine (but it would also execute Delete/Insert triggers if I had any). But I have 50 million rows and will need to update maybe 1/2% of those, all of those deletes and inserts will slow things down. Now logically I thought this should work: insert into Table2 select

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

2008-07-21 Thread Phil
ote: >> > 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 i

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 d

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 co

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 i

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?

"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 rathe

Re: UPDATE rows based on multiple WHERE values?

2008-07-18 Thread Waynn Lue
Thanks, I'll take a look at that. Appreciate the help, Waynn On Sat, Jul 12, 2008 at 9:02 PM, Rob Wultsch <[EMAIL PROTECTED]> wrote: > On Sat, Jul 12, 2008 at 8:01 PM, Waynn Lue <[EMAIL PROTECTED]> wrote: > > Is there any way to have an UPDATE statement change a colum

Re: Update replace / Operand should contain 1 column(s) 1241

2008-07-15 Thread Rob Wultsch
On Tue, Jul 15, 2008 at 7:59 AM, Guenter Ladstaetter <[EMAIL PROTECTED]> wrote: > UPDATE `phpbt_bug` > SET title = REPLACE (phpbt_bug.title,"ö","ö") > WHERE bug_id IN > (select bug_id, title from phpbt_bug where `title` LIKE "%ö%"); > > >

Update replace / Operand should contain 1 column(s) 1241

2008-07-15 Thread Guenter Ladstaetter
Hello, i'm trying to replace german umlauts by using a simple update replace statement but can't find the syntax error: UPDATE `phpbt_bug` SET title = REPLACE (phpbt_bug.title,"ö","ö") WHERE bug_id IN (select bug_id, title from phpbt_bug where `title` LIKE

Re: UPDATE rows based on multiple WHERE values?

2008-07-12 Thread Rob Wultsch
On Sat, Jul 12, 2008 at 8:01 PM, Waynn Lue <[EMAIL PROTECTED]> wrote: > Is there any way to have an UPDATE statement change a column value based on > the WHERE statement? > > Essentially, I want to do something like this > > UPDATE Actions SET ActionsSent = WHERE ActionsR

UPDATE rows based on multiple WHERE values?

2008-07-12 Thread Waynn Lue
Is there any way to have an UPDATE statement change a column value based on the WHERE statement? Essentially, I want to do something like this UPDATE Actions SET ActionsSent = WHERE ActionsReceived = where foo and bar change for multiple sets of values. Is there a way to do this in one SQL

Re: Timestamp and the On Update Current_Timestamp clause

2008-05-24 Thread Moon's Father
Here is my test. Any way can retrieve the metadata. On Fri, May 9, 2008 at 10:45 PM, Martijn Tonies <[EMAIL PROTECTED]> wrote: > > > > SHOW CREATE TABLE ... > > Yes, I thought so :-( > > > From a coding point of view, this requires parsing... > > Why isn't there anything in "show full columns". >

Re: Timestamp and the On Update Current_Timestamp clause

2008-05-09 Thread Martijn Tonies
> SHOW CREATE TABLE ... Yes, I thought so :-( >From a coding point of view, this requires parsing... Why isn't there anything in "show full columns". Martijn Tonies Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle & MS SQL Server Upscene Productions http://www.upsce

Re: Timestamp and the On Update Current_Timestamp clause

2008-05-09 Thread Ben Clewett
SHOW CREATE TABLE ... Martijn Tonies wrote: Hi, How does one know if ON UPDATE CURRENT_TIMESTAMP was specified when creating a column? How do I retrieve this bit of info from the metadata queries? (also MySQL 4.1) Martijn Tonies Database Workbench - tool for InterBase, Firebird, MySQL

Timestamp and the On Update Current_Timestamp clause

2008-05-09 Thread Martijn Tonies
Hi, How does one know if ON UPDATE CURRENT_TIMESTAMP was specified when creating a column? How do I retrieve this bit of info from the metadata queries? (also MySQL 4.1) Martijn Tonies Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle & MS SQL Server Upscene Product

Re: question about update/join query

2008-05-08 Thread Andy Wallace
n for the start. andy Brent Baisley wrote: You can do it in a single UPDATE statement, but you do need a form of a subquery. Why the aversion of a subquery? The simplest approach is to first get what you want using a SELECT statement. Then change SELECT to UPDATE and add your SET statement. In your

Re: question about update/join query

2008-05-07 Thread Andy Wallace
datetime I want to run a query that updates the last_visit column of user with the MAX(event_time) row for which the user_id's match, but only if I find an event: update user U set U.last_visit = (select max(L.event_time) from event_log L where L.user_id = U.user_id) I

Re: question about update/join query

2008-05-07 Thread Andy Wallace
datetime I want to run a query that updates the last_visit column of user with the MAX(event_time) row for which the user_id's match, but only if I find an event: update user U set U.last_visit = (select max(L.event_time) from event_log L where L.user_id = U.user_id I

Re: question about update/join query

2008-05-07 Thread Andy Wallace
se in UPDATE statement? M - Original Message - From: "Andy Wallace" <[EMAIL PROTECTED]> To: "mysql list" Sent: Wednesday, May 07, 2008 1:07 PM Subject: Re: question about update/join query Clarification: I DON'T want to update the last_visit field if the

Re: question about update/join query

2008-05-07 Thread Andy Wallace
Clarification: I DON'T want to update the last_visit field if there is no matching event record... I managed to get this to sort of work: update enduser E set E.last_visit = (select MAX(EL.event_time) from event_log EL where EL.enduser

question about update/join query

2008-05-07 Thread Andy Wallace
Hey all - I have two tables - an event_log table, and a user table. There is a "last_visit" column in the user table, and I want to update it from the event_log with the most recent event timestamp. And I want to do it without a subquery, eventually, both these tables will be pr

Re: Update with select

2008-05-02 Thread Rob Wultsch
> -Original Message- > From: Albert E. Whale [mailto:[EMAIL PROTECTED] > Sent: Friday, May 02, 2008 4:06 PM > To: mysql@lists.mysql.com > Subject: Update with select > > I am trying to update a field on a record in a table. Here is the > statement I create

RE: Update with select

2008-05-02 Thread Rolando Edwards
You are better off with an UPDATE JOIN UPDATE pdata A,pdata B SET A.pvalue = B.pvalue WHERE A.pentrytime = 117540 AND B.pentrytime = 1207022400; Give it a try !!! -Original Message- From: Albert E. Whale [mailto:[EMAIL PROTECTED] Sent: Friday, May 02, 2008 4:06 PM To: mysql

Update with select

2008-05-02 Thread Albert E. Whale
I am trying to update a field on a record in a table. Here is the statement I created: UPDATE pdata SET pvalue = ( SELECT pvalue FROM pdata WHERE pentrytime =1207022400 ) WHERE pentrytime =117540; However, I get the following error: |#1093 - You can't specify target table '

Re: update select question

2008-04-15 Thread Ananda Kumar
update newslettercontent c set c.timestamp= (select n.publishdate from newsletter n where n.NLCID= c.NLCID); This should work. On 4/16/08, Chris W <[EMAIL PROTECTED]> wrote: > > I have the following query... > > SELECT c.NLCID, n.publishdate > FROM newsletter n > JOIN n

Re: update select question

2008-04-15 Thread Sebastian Mendel
Chris W schrieb: I have the following query... SELECT c.NLCID, n.publishdate FROM newsletter n JOIN newslettersection s using (NLID) JOIN newslettercontent c using(NLCID) WHERE contenttype = 1 AND n.publishdate AND c.`timestamp` = '-00-00 00:00:00' I want to run an

update select question

2008-04-15 Thread Chris W
I have the following query... SELECT c.NLCID, n.publishdate FROM newsletter n JOIN newslettersection s using (NLID) JOIN newslettercontent c using(NLCID) WHERE contenttype = 1 AND n.publishdate AND c.`timestamp` = '-00-00 00:00:00' I want to run an update on newslettercontent a

' . . ' can't insert into a date field,but update can

2008-04-11 Thread wang shuming
Hi, table table1 int1 int auto_increament , date date not null default '-00-00' 1) insert into table1 (date) values('. . ') // shows Incorrect date value: '. . ' for column date' at row 1 // '. . ' ==&g

Re: --log-slave-update

2008-04-06 Thread Moon's Father
rajapati > > On Fri, Apr 4, 2008 at 2:28 PM, Ananda Kumar <[EMAIL PROTECTED]> wrote: > > > so, we should not have --log-slave-update on slaves on setup with one > > master and multiple slaves...right. > > > > regards > > anandkl > > > > >

Re: --log-slave-update

2008-04-04 Thread Ananda Kumar
ati > > On Fri, Apr 4, 2008 at 2:28 PM, Ananda Kumar <[EMAIL PROTECTED]> wrote: > > > so, we should not have --log-slave-update on slaves on setup with one > > master and multiple slaves...right. > > > > regards > > anandkl > > > > > > On 4/

Re: --log-slave-update

2008-04-04 Thread Krishna Chandra Prajapati
odel then --log_slave_updates is required. Other in 1 to many model --log_slave_updates is not required Thanks, Krishna Chandra Prajapati On Fri, Apr 4, 2008 at 2:28 PM, Ananda Kumar <[EMAIL PROTECTED]> wrote: > so, we should not have --log-slave-update on slaves on setup with one >

Re: --log-slave-update

2008-04-04 Thread Ananda Kumar
so, we should not have --log-slave-update on slaves on setup with one master and multiple slaves...right. regards anandkl On 4/4/08, Krishna Chandra Prajapati <[EMAIL PROTECTED]> wrote: > > In case of master is down. Slave 1 has to be made as master and > --log_slave_updates ha

Re: --log-slave-update

2008-04-04 Thread Krishna Chandra Prajapati
e master and if log-slave-update > is set on it, then > slave2 might receive data that it might have arleady got from the old > master, which might cause errors like "duplicate keys" etc. > > > On 4/3/08, Krishna Chandra Prajapati <[EMAIL PROTECTED]> wrote: >

Re: --log-slave-update

2008-04-03 Thread Ananda Kumar
But, it also says, that if slave1 is made master and if log-slave-update is set on it, then slave2 might receive data that it might have arleady got from the old master, which might cause errors like "duplicate keys" etc. On 4/3/08, Krishna Chandra Prajapati <[EMAIL PROTECTED]&g

Re: --log-slave-update

2008-04-02 Thread Krishna Chandra Prajapati
all the queries to binlog. In this way 2nd slave get the updates from 1st slave. Krishna Chandra Prajapati On Thu, Apr 3, 2008 at 12:02 PM, Ananda Kumar <[EMAIL PROTECTED]> wrote: > Hi All, > I have Master - Slave setup, with just one slave. > Can i set --log-slave-update on sl

--log-slave-update

2008-04-02 Thread Ananda Kumar
Hi All, I have Master - Slave setup, with just one slave. Can i set --log-slave-update on slave. I have mysql running on debain with 8 cpu and 8 GB RAM. Also in this link http://dev.mysql.com/doc/refman/5.0/en/replication-solutions-switch.html Its says not to set --log-slave-update on slave

Re: Optimize db update

2008-03-22 Thread Velen
riginal Message - From: "Daniel Brown" <[EMAIL PROTECTED]> To: "Velen" <[EMAIL PROTECTED]> Cc: Sent: Friday, March 21, 2008 6:10 PM Subject: Re: Optimize db update > On Fri, Mar 21, 2008 at 10:04 AM, Velen <[EMAIL PROTECTED]> wrote: > > This one i

Re: Optimize db update

2008-03-21 Thread Daniel Brown
On Fri, Mar 21, 2008 at 10:04 AM, Velen <[EMAIL PROTECTED]> wrote: > This one is alright but is there an alternative that can be run with the > mysql> prompt? Not to dump a file, but to import, yes. Check out the LOAD DATA INFILE command: http://dev.mysql.com/doc/refman/5.0/en/load-d

Re: Optimize db update

2008-03-21 Thread Velen
This one is alright but is there an alternative that can be run with the mysql> prompt? Thanks. Velen - Original Message - From: "Daniel Brown" <[EMAIL PROTECTED]> To: "Velen" <[EMAIL PROTECTED]> Cc: Sent: Friday, March 21, 2008 6:00 PM Subject: Re:

Re: Optimize db update

2008-03-21 Thread Daniel Brown
On Fri, Mar 21, 2008 at 9:14 AM, Velen <[EMAIL PROTECTED]> wrote: > This does not solve my problem. DatabaseA and DatabaseB are on 2 seperate > pc and the only communication that can be use between the two PC is a USB > pendrive. > > Is there another way of copying a table from one Database to

Re: Optimize db update

2008-03-21 Thread Velen
This does not solve my problem. DatabaseA and DatabaseB are on 2 seperate pc and the only communication that can be use between the two PC is a USB pendrive. Is there another way of copying a table from one Database to another? I don't want to update TableA directly as I want to validat

Re: Optimize db update

2008-03-20 Thread Phil
Are the table structures identical ? If so, you could just move the data files themselves. Otherwise consider using unload from table B into seperated format (mysql load format) truncate table A load data infile into table A On Thu, Mar 20, 2008 at 2:20 PM, Daniel Brown <[EMAIL PROTECTED]> w

Re: Optimize db update

2008-03-20 Thread Daniel Brown
On Thu, Mar 20, 2008 at 1:41 PM, Velen <[EMAIL PROTECTED]> wrote: > > Actually I am updating TableA in DatabaseA with values from TableB in > DatabaseB. Database B is on a stand alone PC. I'm using VB6 to create a > .txt file containing data from TableB then using VB6 once more to > recronstr

Optimize db update

2008-03-20 Thread Velen
Hi, Actually I am updating TableA in DatabaseA with values from TableB in DatabaseB. Database B is on a stand alone PC. I'm using VB6 to create a .txt file containing data from TableB then using VB6 once more to recronstruct the table in DatabaseA then remove all data which are already in Tab

Re: Odd Update Question.

2008-02-29 Thread m i l e s
Folks, Thanks for the 'help'. Oy. I figured it out from some help on the Lasso discussion list. All I had to do was properly address ALL the tables I wanted to touch. So this: UPDATE tbe_gallery SET tbe_gsa.gsa_paperprice = tbe_gallery.gallery_gsaprice_paper WHERE tbe_gallery.

Re: Odd Update Question.

2008-02-28 Thread Rob Wultsch
> > I'm wondering if the following can be done > > UPDATE tbe_gallery > SET tbe_gsa.gsa_paperprice = tbe_gallery.gallery_gsaprice_paper > WHERE tbe_gallery.gallery_id = tbe_images.img_rel_id AND >tbe_images.img_orig_filename = tbe_gsa.gsa_id > > Let me

Odd Update Question.

2008-02-27 Thread m i l e s
Hi, I'm wondering if the following can be done.... UPDATE tbe_gallery SET tbe_gsa.gsa_paperprice = tbe_gallery.gallery_gsaprice_paper WHERE tbe_gallery.gallery_id = tbe_images.img_rel_id AND tbe_images.img_orig_filename = tbe_gsa.gsa_id Let me explain: I have 3 tables and only 1 of

Re: Very slow update

2008-02-07 Thread mos
Phil, What happens if you drop the index when you do the update? Does it run faster? If so then the index is slowing you down. Try increasing the key_buffer_size to 756M. If there isn't much difference, try the update without the "Order By" clause. If it runs considerably f

Very slow update

2008-02-07 Thread Phil
I'm trying to write an update which generates ranking data for a table. Table is as follows CREATE TABLE `A` ( `id` INT NOT NULL , `score` DOUBLE NOT NULL , `projrank` INT NOT NULL , `other` VARCHAR( 10 ) NOT NULL ) ENGINE = MYISAM Real table actually contains 30 or so more fields but it

Re: Error: You can't specify target table '...' for update in FROM clause

2008-02-07 Thread Yves Goergen
On 07.02.2008 03:52 CE(S)T, Chris wrote: If you don't mind a mysql-specific "fix", and can get the data you want from a select query you could: insert into table (select goes here) on duplicate key update; or maybe a replace into ? INSERT/REPLACE ... SELECT will always overw

Re: Error: You can't specify target table '...' for update in FROM clause

2008-02-06 Thread Chris
Yves Goergen wrote: On 06.02.2008 08:12 CE(S)T, Chris wrote: Yves Goergen wrote: My goal was to copy some potentially large BLOB from one record to another in the same table Update table set blob2_field=blob1_field; This does something totally different. ;) See my first posting why. Ah

RE: Error: You can't specify target table '...' for update in FROM clause

2008-02-06 Thread Jerry Schwartz
> -Original Message- > From: Yves Goergen [mailto:[EMAIL PROTECTED] > Sent: Tuesday, February 05, 2008 6:22 PM > To: Baron Schwartz > Cc: mysql@lists.mysql.com > Subject: Re: Error: You can't specify target table '...' for update in > FROM clause &

Re: Error: You can't specify target table '...' for update in FROM clause

2008-02-06 Thread Yves Goergen
On 06.02.2008 08:12 CE(S)T, Chris wrote: Yves Goergen wrote: My goal was to copy some potentially large BLOB from one record to another in the same table Update table set blob2_field=blob1_field; This does something totally different. ;) See my first posting why. -- Yves Goergen

Re: Error: You can't specify target table '...' for update in FROM clause

2008-02-05 Thread Chris
to fetch it from the database and have my application just write it back again. I wanted to avoid this unnecessary copying around. Update table set blob2_field=blob1_field; -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Re: Error: You can't specify target table '...' for update in FROM clause

2008-02-05 Thread Yves Goergen
from the database and have my application just write it back again. I wanted to avoid this unnecessary copying around. However, you can do multi-table updates like this: UPDATE tbl AS a INNER JOIN tbl AS b ON SET a.col = b.col That sounds interesting, however, I couldn't find it in P

Re: Error: You can't specify target table '...' for update in FROM clause

2008-02-05 Thread Baron Schwartz
Hi, On Feb 5, 2008 11:26 AM, Yves Goergen <[EMAIL PROTECTED]> wrote: > Hi, > > I've got an error message from MySQL 5.0 that I don't understand. > > UPDATE "message_revision" SET "HasData" = 1, "Data" = (SELECT "Data" &

Error: You can't specify target table '...' for update in FROM clause

2008-02-05 Thread Yves Goergen
Hi, I've got an error message from MySQL 5.0 that I don't understand. UPDATE "message_revision" SET "HasData" = 1, "Data" = (SELECT "Data" FROM "message_revision" WHERE "MessageId" = 7 AND "RevisionNumber" = 5) W

Re: update to last 5.0 GA

2008-02-05 Thread paul rivers
Thomas Raso wrote: Hi all, I want to know the main differences between mysql 5.0.41 and MySQL 5.0.51a(last GA release) I read this page : http://dev.mysql.com/doc/refman/5.0/en/mysql-nutshell.html but there is nothing about the developments made by such update... thnaks all... Try this

update to last 5.0 GA

2008-02-05 Thread Thomas Raso
Hi all, I want to know the main differences between mysql 5.0.41 and MySQL 5.0.51a(last GA release) I read this page : http://dev.mysql.com/doc/refman/5.0/en/mysql-nutshell.html but there is nothing about the developments made by such update... thnaks all...

Re: feature request: statement SELECT...(INSERT|UPDATE) :)

2008-01-30 Thread Martijn Tonies
> On Jan 30, 2008 12:50 PM, Dmitry E. Oboukhov wrote: > > Is it possible to add to the syntax of the INSERT operator appoximately > > in such way: > > SELECT list INSERT [IGNORE] INTO ... - an added one. > > SELECT list UPDATE - an added one. > > > PS:

Re: feature request: statement SELECT...(INSERT|UPDATE) :)

2008-01-30 Thread Jochem van Dieten
On Jan 30, 2008 12:50 PM, Dmitry E. Oboukhov wrote: > Is it possible to add to the syntax of the INSERT operator appoximately > in such way: > SELECT list INSERT [IGNORE] INTO ... - an added one. > SELECT list UPDATE - an added one. > PS: I understand that adding the changes

feature request: statement SELECT...(INSERT|UPDATE) :)

2008-01-30 Thread Dmitry E. Oboukhov
very often the resulting values are needed at once for report representation or for using in the next statements INSERT) So: The INSERT(UPDATE) statement returns the quantity of strings inserted(updated) into a table. (*) However as far as I understand at the stage of fulfilling this operator mysql oper

fast insert/update on partitioned table using hash

2008-01-15 Thread Britske
Hi, I have a partitioned table based on hash, like so: PARTITION BY HASH(id1) PARTITIONS 1000; I have lots and lots of rows (therefore the high number of partitions) and since id1 is auto-incremented the distribution is pretty even. The problem is that every night I need to update all rows

Re: Update but insert if not exist

2007-12-17 Thread Jay Pipes
INSERT ... ON DUPLICATE KEY UPDATE: http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html Cheers, Jay J Trahair wrote: This is a question I want to know the answer to, as well! Is there any way of avoiding looking up a specific record in a table to see if it exists, before

Re: Update but insert if not exist

2007-12-17 Thread J Trahair
This is a question I want to know the answer to, as well! Is there any way of avoiding looking up a specific record in a table to see if it exists, before deciding whether to INSERT INTO or UPDATE, eg: mstrSQL = "SELECT * FROM Shops WHERE ShopReference = '" & grd1.Tex

Re: Update but insert if not exist

2007-12-17 Thread Rob Wultsch
On Dec 16, 2007 10:29 AM, Afan Pasalic <[EMAIL PROTECTED]> wrote: > try REPLACE > http://dev.mysql.com/doc/refman/5.1/en/replace.html > > -afan Replace will not do an update. All previous data will be lost. A mysql-centric alternative solution would be to use INSERT ... ON DU

Re: Update but insert if not exist

2007-12-16 Thread Afan Pasalic
possible to insert if not there for example Update if anyone not found then insert new with same criteria as update Where region_id in (2,3,4,5,6) Thanks Steffan --- T E L 6 0 2 . 7 9 3 . 0 0 1 4 | F A X 6 0 2 . 9 7 1 . 1 6 9

Update but insert if not exist

2007-12-16 Thread Steffan A. Cline
I am trying to think of a trick way to handle something. I have been successful in using the multiple inserts in one row by using the ,(xx,xx,xx),(xx,xx,xx),(xx,xx,xx) in a values block. BUT Is it possible to insert if not there for example Update if anyone not found then insert new

Logout after table update

2007-12-05 Thread Éric Fournier/CSPQ
Hi everyone , I'm new to the mysql administration world (couple months). Couple days ago a client came up with the following situation he got logged out after editing a table (tt_content table part of typo3) He thinks he was kicked out because he tried to upd

Re: possible combine update statement

2007-12-05 Thread Mark Rogers
Hiep Nguyen wrote: i have a loop to update my table: update tbl_idea set col1 = 'text1', col2 = NOW() where ideaID = 1; update tbl_idea set col1 = 'text2', col2 = NOW() where ideaID = 5; ... update tbl_idea set col1 = 'textzzz', col2 = NOW() where ideaID = XXX;

Re: possible combine update statement

2007-12-05 Thread Baron Schwartz
On Dec 5, 2007 8:48 AM, Hiep Nguyen <[EMAIL PROTECTED]> wrote: > hi list, > > i have a loop to update my table: > > update tbl_idea set col1 = 'text1', col2 = NOW() where ideaID = 1; > update tbl_idea set col1 = 'text2', col2 = NOW() where ideaID = 5;

possible combine update statement

2007-12-05 Thread Hiep Nguyen
hi list, i have a loop to update my table: update tbl_idea set col1 = 'text1', col2 = NOW() where ideaID = 1; update tbl_idea set col1 = 'text2', col2 = NOW() where ideaID = 5; ... update tbl_idea set col1 = 'textzzz', col2 = NOW() where ideaID = XXX; my q

RE: Update Join with Aliases

2007-11-30 Thread Jerry Schwartz
d 195 Farmington Ave. Farmington, CT 06032 860.674.8796 / FAX: 860.674.8341 www.the-infoshop.com www.giiexpress.com www.etudes-marche.com > -Original Message- > From: Elissa Joan [mailto:[EMAIL PROTECTED] > Sent: Friday, November 30, 2007 12:05 PM > To: mysql@lists.mysql.com >

Update Join with Aliases

2007-11-30 Thread Elissa Joan
Hello. I am having a time trying to get this to work. I hope someone can help me wit the syntax! Here is the original query: UPDATE ambien_nev.Sections INNER JOIN ambien_nev.Sections ON natural_db.Sections.section_id = ambien_nev.Sections.section_id SET ambien_nev.Sections.feature1

RE: repost timestamp for update & insert

2007-11-29 Thread Jerry Schwartz
age- > From: Hiep Nguyen [mailto:[EMAIL PROTECTED] > Sent: Thursday, November 29, 2007 10:24 AM > To: mysql@lists.mysql.com > Subject: repost timestamp for update & insert > > i asked this question before, but when i tried what D.Vin suggested, i > got > an error. &g

RE: repost timestamp for update & insert

2007-11-29 Thread joe
Your missing your data type for the spdate_updated attribute CREATE TABLE tbl_spdate( spdate_ID int NOT NULL PRIMARY KEY AUTO_INCREMENT , spdate_date date NOT NULL , spdate_notes varchar( 100 ) , spdate_created timestamp default 0, spdate_updated timestamp default CURRENT_TIMESTAMP ON UPDATE

repost timestamp for update & insert

2007-11-29 Thread Hiep Nguyen
, spdate_updated default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ); and i got this: #1064 - 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 'default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP )'

Re: Deadlocks with High Concurrency SELECT FOR UPDATE

2007-10-16 Thread Baron Schwartz
n1 select * from quicktable; +---+--+ | x | quick_id | +---+--+ | 1 |0 | +---+--+ 1 row in set (0.00 sec) I have a large number of connections executing these queries: BEGIN: SELECT quick_id FROM quicktable FOR UPDATE; COMMIT; This works well until I hit a large

<    1   2   3   4   5   6   7   8   9   10   >