update query

2012-04-30 Thread Pothanaboyina Trimurthy
Hi all, i have one database with 120 tables and each table contains one common column that is client now i want to update all the tables column client = NEW. is it possible to write a single query to update this one. please help me. thanks in advance Thanks Kind Regards, Trimurthy.p --

Re: update query

2012-04-30 Thread Ananda Kumar
Do you just want to replace current value in client column to NEW. You can write a stored proc , with a cursor and loop through the cursor, update each table. regards anandkl On Mon, Apr 30, 2012 at 2:47 PM, Pothanaboyina Trimurthy skd.trimur...@gmail.com wrote: Hi all, i have one

回复: update query

2012-04-30 Thread Zhangzhigang
use database;update $i set client='NEW'     fi     let c=$c+1 done 发件人: Ananda Kumar anan...@gmail.com 收件人: Pothanaboyina Trimurthy skd.trimur...@gmail.com 抄送: mysql@lists.mysql.com 发送日期: 2012年4月30日, 星期一, 下午 5:26 主题: Re: update query Do you just want

RE: update query

2012-04-30 Thread Rick James
= 'dbname' information_schema.COLUMNS WHERE COLUMN_NAME = 'client' -Original Message- From: Ananda Kumar [mailto:anan...@gmail.com] Sent: Monday, April 30, 2012 2:26 AM To: Pothanaboyina Trimurthy Cc: mysql@lists.mysql.com Subject: Re: update query Do you just want to replace

Update query problem

2010-09-16 Thread Andy Wallace
So I'm having a problem with an update query. I have three tables: Table: A Columns: acnt, name, company, email, domain Table: AM Columns: acnt, m_id Table: M Columns: m_id, name, company, email, domain and I want to conditionally update the columns in one to values from the other. i.e

RE: Update query problem

2010-09-16 Thread Travis Ard
Try using the IS NULL operator instead of ! -Travis -Original Message- From: Andy Wallace [mailto:awall...@ihouseweb.com] Sent: Thursday, September 16, 2010 10:47 AM To: mysql@lists.mysql.com Subject: Update query problem So I'm having a problem with an update query. I have three

Re: Speeding up a pretty simple correlated update query

2009-09-06 Thread Hank
Hello All, I'm reposting this since I didn't get much response the last time, so I'm hoping to reach out again. My correlated update query (see below) was running for 9 days before I killed it. Here is my original question: I have a legacy application which was written using a compound

Re: Speeding up a pretty simple correlated update query

2009-09-06 Thread mos
wrote: Hello All, I'm reposting this since I didn't get much response the last time, so I'm hoping to reach out again. My correlated update query (see below) was running for 9 days before I killed it. Here is my original question: I have a legacy application which was written using a compound

Re: Speeding up a pretty simple correlated update query

2009-09-06 Thread Hank
On Sun, Sep 6, 2009 at 6:01 PM, mos mo...@fastmail.fm wrote: So I've disabled all the keys on the item_trans table -- since I am updating every row, it wouldn't (shouldn't) be using the index anyway. You can't disable unique indexes or primary keys. They are always active. You can only

Speeding up a pretty simple correlated update query

2009-09-02 Thread Hank
the main transaction table with the new sequence number. So I've disabled all the keys on the item_trans table -- since I am updating every row, it wouldn't (shouldn't) be using the index anyway. Here is my correlated update query: update item_trans i, item_seq is set i.seq=is.seq where

RE: Speeding up a pretty simple correlated update query

2009-09-02 Thread Gavin Towey
...@gmail.com] Sent: Wednesday, September 02, 2009 4:35 PM To: mysql@lists.mysql.com Subject: Speeding up a pretty simple correlated update query Hello All, I have a legacy application which was written using a compound primary key of an item number (non unique) along with a category ID

Re: Speeding up a pretty simple correlated update query

2009-09-02 Thread Hank
table and update with a join. Regards, Gavin Towey -Original Message- From: Hank [mailto:hes...@gmail.com] Sent: Wednesday, September 02, 2009 4:35 PM To: mysql@lists.mysql.com Subject: Speeding up a pretty simple correlated update query Hello All, I have a legacy application

Re: Mysql update query gives error of lock wait timeout

2009-08-29 Thread muhammad subair
On Sat, Aug 29, 2009 at 12:09 PM, Manasi Save manasi.s...@artificialmachines.com wrote: Hi All, I have a query which gives an error of lock wait timeout only this transaction is running with 2 records in the table. The query is : Update Test Set TestFlag = 1 Where TestID = 5; Can

Re: Mysql update query gives error of lock wait timeout

2009-08-29 Thread Manasi Save
Hi, You are right. The storage engine i m using is InnoDB. but then my concern is why this simple update query takes so long. Is it true that if its innodb table then even after specifying where condition it scans all indexed rows. I am bit confused as mysql.com have mentioned on there site

Re: Mysql update query gives error of lock wait timeout

2009-08-29 Thread Krishna Chandra Prajapati
Increase your Innodb_buffer_pool_size. It will solve your problem. Thanks, Krishna On Sat, Aug 29, 2009 at 10:39 AM, Manasi Save manasi.s...@artificialmachines.com wrote: Hi All, I have a query which gives an error of lock wait timeout only this transaction is running with 2 records in

Mysql update query gives error of lock wait timeout

2009-08-28 Thread Manasi Save
Hi All, I have a query which gives an error of lock wait timeout only this transaction is running with 2 records in the table. The query is : Update Test Set TestFlag = 1 Where TestID = 5; Can this one transaction lock my entire table? -- Thanks and Regards, Manasi Save Artificial

Error 1064 on a basic UPDATE query

2007-10-15 Thread James Graham
Hi List, We have a transactions table (~600k records). I'm trying a simple update query, it fails. I thought this could be due to a reserved word problem, but all names have been escaped. mysql UPDATE `tblTransaction` SET `TYPE` = 'Manual' WHERE (`ORDERID` = '694215576aac60f10c9eebe4a5a39d0f

Re: Error 1064 on a basic UPDATE query

2007-10-15 Thread Baron Schwartz
Hi, James Graham wrote: Hi List, We have a transactions table (~600k records). I'm trying a simple update query, it fails. I thought this could be due to a reserved word problem, but all names have been escaped. mysql UPDATE `tblTransaction` SET `TYPE` = 'Manual' WHERE (`ORDERID

Update query question

2007-02-02 Thread Jerry Jones
I am new to mysql. I am trying to do a simple update query to update a field based on the contents of another field in the same table. Here is what I have. update inventory_items set name = necklace where description like %necklace%; I am not sure what is wrong. select * from inventory_items

Re: Update query question

2007-02-02 Thread ViSolve DB Team
Hi,, The Update query of yours will do fine.. otherwise try using string functions [instr()] like mysql update inventory_items set name='necklace' where instr(description,'necklace')0; Thanks ViSolve DB Team. - Original Message - From: Jerry Jones [EMAIL PROTECTED] To: mysql

Update query help

2006-12-06 Thread Ravi Kumar.
Dear Friends, I have two tables: T1, T2. T1 has 3 columns: playerid, gameid, score T2 has 2 columns: playerid, totalscore. I wish to update table T2 such that sum of T1.score of each player, gets updated in T2.totalscore. It may be something like this: update T2, T1 set T2.totalscore =

Re: Update query help

2006-12-06 Thread ViSolve DB Team
:11 PM Subject: Update query help Dear Friends, I have two tables: T1, T2. T1 has 3 columns: playerid, gameid, score T2 has 2 columns: playerid, totalscore. I wish to update table T2 such that sum of T1.score of each player, gets updated in T2.totalscore. It may be something like this: update

Re: Update query help

2006-12-06 Thread Remo Tex
, December 06, 2006 4:11 PM Subject: Update query help Dear Friends, I have two tables: T1, T2. T1 has 3 columns: playerid, gameid, score T2 has 2 columns: playerid, totalscore. I wish to update table T2 such that sum of T1.score of each player, gets updated in T2.totalscore. It may

Re: Update query help

2006-12-06 Thread Remo Tex
Ravi Kumar. wrote: Dear Friends, I have two tables: T1, T2. T1 has 3 columns: playerid, gameid, score T2 has 2 columns: playerid, totalscore. I wish to update table T2 such that sum of T1.score of each player, gets updated in T2.totalscore. It may be something like this: update T2, T1

Update query in order to modify some fields

2006-11-17 Thread spacemarc
Hi I have more fields with values as the-object1 the-object2 the-object45 I must to change only the part begins them to other words, example: the-object2 must become an-object2 Which syntax I can use? Thanks in advance -- http://www.spacemarc.it -- MySQL General Mailing List For list

Re: Update query in order to modify some fields

2006-11-17 Thread spacemarc
,the,an); +---+ | replace(the-object1,the,an) | +---+ | an-object1| +---+ 1 row in set (0.09 sec) ok. I will use the replace function in Update query. -- http://www.spacemarc.it -- MySQL General Mailing List For list

RE: Update query in order to modify some fields

2006-11-17 Thread Jerry Schwartz
, November 17, 2006 9:27 AM To: Mike Kruckenberg Cc: mysql@lists.mysql.com Subject: Re: Update query in order to modify some fields 2006/11/17, Mike Kruckenberg [EMAIL PROTECTED]: If it's values you are updating you can use the replace() string function to do something like this: update table1

RE: help with update query

2006-10-16 Thread Jerry Schwartz
Information Incorporated 195 Farmington Ave. Farmington, CT 06032 860.674.8796 / FAX: 860.674.8341 -Original Message- From: Ferindo Middleton [mailto:[EMAIL PROTECTED] Sent: Saturday, October 14, 2006 9:16 PM To: Dan Buettner Cc: mysql Subject: Re: help with update query Thanks Dan

Re: help with update query

2006-10-16 Thread Ferindo Middleton
Incorporated 195 Farmington Ave. Farmington, CT 06032 860.674.8796 / FAX: 860.674.8341 -Original Message- From: Ferindo Middleton [mailto:[EMAIL PROTECTED] Sent: Saturday, October 14, 2006 9:16 PM To: Dan Buettner Cc: mysql Subject: Re: help with update query Thanks Dan. This does

Re: help with update query

2006-10-14 Thread Dan Buettner
Ferindo, I had a similar task recently, and the problem you'll run into is that you can't select from and update the same table at once. What I ended up doing was doing a SELECT to build the update queries for me. Something like this: SELECT CONCAT( UPDATE bowler_score SET email_address = ',

Re: help with update query

2006-10-14 Thread Ferindo Middleton
Thanks Dan. This does help. This a pretty straight-forward idea. I could even save the results of this query to a text file and possibly review it a little before running it so I don't acidentally do anything funky and I could see the impact this would have on the data before applying it. I

Re: Re: help with update query

2006-10-14 Thread Dan Buettner
Good call on the WHERE email_address IS NULL thing. Also occurs to me you could do a SELECT DISTINCT instead of just a SELECT to eliminate duplicate update commands. Glad this was useful. Dan On 10/14/06, Ferindo Middleton [EMAIL PROTECTED] wrote: Thanks Dan. This does help. This a pretty

help with update query

2006-10-13 Thread Ferindo Middleton
I have a table, bowler_score_records, with the following columns: id, firstname, middlename, lastname, race, religion, email_address, bowling_score, gamedate As records get entered to this table, sometimes the users forget to input the email_address but the users always capture the full name,

Need Update Query Help (Urgent)

2006-02-20 Thread Veerabhadrarao Narra
Hi i ahve one table table_1 and columns like col_1,col_2,col_3 col_1 col_2 col_3 1 aa aaa 2 bb Now i want to update my table table_1 SET col_3 as bbb where max of col_1 I wrote this below Query but it shows error how to write UPDATE table_1 SET col_3 = 'bbb'

Re: Need Update Query Help (Urgent)

2006-02-20 Thread Jeff Shapiro
On Monday 20 February 2006 03:27, Veerabhadrarao Narra wrote: Hi i ahve one table table_1 and columns like col_1,col_2,col_3 col_1 col_2 col_3 1 aa aaa 2 bb Now i want to update my table table_1 SET col_3 as bbb where max of col_1 I wrote this below

Re: Need Update Query Help (Urgent)

2006-02-20 Thread Peter Brawley
I wrote this below Query but it shows error how to write UPDATE table_1 SET col_3 = 'bbb' WHERE col_1 = (SELECT max(col_1) FROM table_1) See the docs for Update at http://dev.mysql.com/doc/refman/5.0/en/update.html. You cannot refer to the update table in a subquery. PB -

Update query

2006-01-24 Thread Jørn Dahl-Stamnes
values, but the format is different ('001234' vs 1234). Is it possible to create a update query that copies the 'foo' and 'bar' from table dbA.A to dbB.B for each record in dbB.B? -- Jørn Dahl-Stamnes homepage: http://www.dahl-stamnes.net/dahls/ -- MySQL General Mailing List For list archives

Re: Update query

2006-01-24 Thread Gleb Paharenko
, but the format is different ('001234' vs 1234). Is it possible to create a update query that copies the 'foo' and 'bar' from table dbA.A to dbB.B for each record in dbB.B? -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.NET http

Re: Update query

2006-01-24 Thread Jørn Dahl-Stamnes
On Tuesday 24 January 2006 12:03, Gleb Paharenko wrote: Hello. If dbA.id has the format you have specified MySQL should be able to silently convert the type from char to int, and you can work with dbA.id as it is integer column. mysql create table ch(id char(6)); Query OK, 0 rows affected

Update query to set random data

2005-07-01 Thread zzapper
Hi, In order to generate some useful test data eg randomnly setting the flag select_normal to 0 or 1 use the following update tbl_products set select_normal=round(rand()); I've actually answered my own question (as usual in formulating the question you often can workout the answer) But anyone

Re: Subselect in an Update query

2005-06-18 Thread Jochem van Dieten
On 6/17/05, [EMAIL PROTECTED] wrote: There is one caveat: It is not currently possible to modify a table and select from the same table in a subquery. That is not the only problem: there is no guarantee the subquery will only return one record. So even if MySQL wouldn't have this limitation

Subselect in an Update query

2005-06-17 Thread Ed Reed
Can anyone tell me how I can make this work or suggest a work around? Update table1 Set field1=(Select field1 From table1 Where field2=Some Value) Where field2 =Another Value; Thanks

Re: Subselect in an Update query

2005-06-17 Thread SGreen
Ed Reed [EMAIL PROTECTED] wrote on 06/17/2005 01:35:40 PM: Can anyone tell me how I can make this work or suggest a work around? Update table1 Set field1=(Select field1 From table1 Where field2=Some Value) Where field2 =Another Value; Thanks OK, your example must be broken (or it

Re: Subselect in an Update query

2005-06-17 Thread mfatene
Hi, There is one caveat: It is not currently possible to modify a table and select from the same table in a subquery. this phrase is from http://dev.mysql.com/tech-resources/articles/4.1/subqueries.html solution * create table t as Select field1 From table1 Where field2=Some Value

Re: Subselect in an Update query

2005-06-17 Thread Ed Reed
Sorry, I thought it was easy to understand. I wanna update a field in a table with a value from the same field but from a different record of the same table. For example, using the query in my original message, +--+ |RecID |FIELD1 |FIELD2 |

Re: Subselect in an Update query

2005-06-17 Thread Eric Bergen
Could you accomplish this with an update and self join? Ed Reed wrote: Sorry, I thought it was easy to understand. I wanna update a field in a table with a value from the same field but from a different record of the same table. For example, using the query in my original message,

Re: Subselect in an Update query

2005-06-17 Thread Ed Reed
Thanks [EMAIL PROTECTED] 6/17/05 2:03:02 PM Hi, There is one caveat: It is not currently possible to modify a table and select from the same table in a subquery. this phrase is from http://dev.mysql.com/tech-resources/articles/4.1/subqueries.html solution * create table t as Select

Re: Subselect in an Update query

2005-06-17 Thread Ed Reed
Thanks for the reply. What do you mean by 'self join'? Eric Bergen [EMAIL PROTECTED] 6/17/05 4:39:28 PM Could you accomplish this with an update and self join? Ed Reed wrote: Sorry, I thought it was easy to understand. I wanna update a field in a table with a value from the same field

UPDATE Query

2005-05-12 Thread shaun thornburgh
Hi, I am getting an error on the following query and but can't understand why, the syntax looks fine to me! mysql UPDATE CSV_Upload_Data SET SUBSTRING(PRACT_ASCII, 16, 6) = '11' WHERE Insertion_ID = 190716; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that

RE: UPDATE Query

2005-05-12 Thread Partha Dutta
= 190716; -- Partha Dutta, Senior Consultant MySQL Inc, NY, USA, www.mysql.com Are you MySQL certified? www.mysql.com/certification -Original Message- From: shaun thornburgh [mailto:[EMAIL PROTECTED] Sent: Thursday, May 12, 2005 9:47 AM To: mysql@lists.mysql.com Subject: UPDATE Query

General substring update query required

2005-03-27 Thread zzapper
Hi, I want to replace every occurence of a string with another. The following query works fine (appears to anyway) update tbl_websitepages set page_content=replace (page_content,'develop','bucket'); But is there any way to get any Regexp into the substitution? -- MySQL General Mailing List

Help with an UPDATE query please

2004-12-29 Thread shaun thornburgh
Hi, I am having trouble with an UPDATE query. I have three tables as defined below. My database holds data for bookings. Each booking relates to a project. Each project has many tasks, one of which is a booking. I have now added the column Task_ID to the bookings table. How can I update all

RE: Help with an UPDATE query please

2004-12-29 Thread Jay Blanchard
[snip] I am having trouble with an UPDATE query. I have three tables as defined below. My database holds data for bookings. Each booking relates to a project. Each project has many tasks, one of which is a booking. I have now added the column Task_ID to the bookings table. How can I update all

RE: Help with an UPDATE query please

2004-12-29 Thread shaun thornburgh
[EMAIL PROTECTED], mysql@lists.mysql.com Subject: RE: Help with an UPDATE query please Date: Wed, 29 Dec 2004 13:53:07 -0600 [snip] I am having trouble with an UPDATE query. I have three tables as defined below. My database holds data for bookings. Each booking relates to a project. Each project

RE: Help with an UPDATE query please

2004-12-29 Thread Jay Blanchard
[snip] I am using version 3.23.54, unfortunately I am unable to supply test data but basically I need to update the Task_ID column for the Bookings table so that it is the same as the Task_ID for Tasks and the Task_Name is 'Booking' and the Bookings Project_ID is the same as the Tasks

Update Query with special conditions.

2004-11-24 Thread list 123.
Using mySQL 4.0, I would like to know how I can code a query that will change the value of Participants.Active from Y to N is for three or more CONSECUTIVE sessions they have Attendance.Present = 'No'? The Attendance Table has Attendance.Session which coresponds to Sessions.SessionID and

Re: Update Query with special conditions.

2004-11-24 Thread GH
I am curious about doing something simular to this... does anyone have an idea On Wed, 24 Nov 2004 00:43:32 -0500, list 123. list wrote: Using mySQL 4.0, I would like to know how I can code a query that will change the value of Participants.Active from Y to N is for three or more CONSECUTIVE

Re: long update query does not replicate correctly (cont.)

2004-11-18 Thread Sasha Pachev
Przemyslaw Popielarski wrote: Sasha Pachev [EMAIL PROTECTED] wrote: Check if you have any replication restricting rules on the slave. There might be a bug that incorrectly flags a query to be excluded. If that is the case, then try to re-write the rules to see if you can get around the bug. Yes.

Re: long update query does not replicate correctly (cont.)

2004-11-13 Thread Przemyslaw Popielarski
Sasha Pachev [EMAIL PROTECTED] wrote: Check if you have any replication restricting rules on the slave. There might be a bug that incorrectly flags a query to be excluded. If that is the case, then try to re-write the rules to see if you can get around the bug. Yes. I have recently add the

long update query does not replicate correctly

2004-11-12 Thread Przemyslaw Popielarski
I'm executing on master a long and complicated query such: UPDATE (lots of tables, lots of LEFT JOIN) SET ... WHERE . The query updates i.e. 3816 rows. The query DOES replicate do master's and slave's binary log. But it DOES NOT execute on slave. 3816 rows are not updated on slave and slave

Re: long update query does not replicate correctly (cont.)

2004-11-12 Thread Przemyslaw Popielarski
I'm executing on master a long and complicated query such: UPDATE (lots of tables, lots of LEFT JOIN) SET ... WHERE . Okey, I simplified the query to: - UPDATE tKsidata, tKsiabeksiazki SET tKsidata.STAN_REALNY=tKsiabeksiazki.STAN WHERE tKsidata.ksi='0815120877' and

Re: long update query does not replicate correctly (cont.)

2004-11-12 Thread Sasha Pachev
Przemyslaw Popielarski wrote: I'm executing on master a long and complicated query such: UPDATE (lots of tables, lots of LEFT JOIN) SET ... WHERE . Okey, I simplified the query to: - UPDATE tKsidata, tKsiabeksiazki SET tKsidata.STAN_REALNY=tKsiabeksiazki.STAN WHERE

Update query help

2004-11-05 Thread Jeff McKeon
I have two tables. One has a list of customers. The other has a record of customer transactions including unix datestamps of each transaction. I've added a field to the customer table called First_Transaction I want to update this field with the datestamp of the first transaction for each

Re: Update query help

2004-11-05 Thread SGreen
Break it down into two steps. Compute your new values by customerid, then update your customer table with your computed data. CREATE TEMPORARY TABLE tmpFirstTran SELECT CustID, min(Datestamp) as mindate from Transactions group by CustID; update Customer c INNER JOIN tmpFirstTran ft ON ft.CustID

RE: Update query help

2004-11-05 Thread Jeff McKeon
Yeah I thought of that but was hoping not to have to use a temp table. Thanks! Jeff -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, November 05, 2004 9:25 AM To: Jeff McKeon Cc: [EMAIL PROTECTED] Subject: Re: Update query help Break it down into two

Complex update query

2004-10-18 Thread Mauricio Pellegrini
Hi, I don't know if this is possible ( my experience with SQL is very short) but I need to update table A from table B but saving the Old values from certain columns into table C. In other words I have 3 tables A,B,C. Table A is going to be updated with values from table B, but I have to keep

Re: How can I turn this into an update query?

2004-10-15 Thread Philippe Poelvoorde
Ed Lazor wrote: Is there a way for me to change this select query into an update query? select t1.ID, t1.Title, t2.Title from products t1, systems t2 where t1.Title like CONCAT(t2.Title, %) A lot of products have the system title as the first part of the product title. I'm trying to update

How can I turn this into an update query?

2004-10-14 Thread Ed Lazor
Is there a way for me to change this select query into an update query? select t1.ID, t1.Title, t2.Title from products t1, systems t2 where t1.Title like CONCAT(t2.Title, %) A lot of products have the system title as the first part of the product title. I'm trying to update the product SystemID

update query return value

2004-09-20 Thread Jeff Demel
I'm seeing some odd behavior when I run an UPDATE query, and need to know if this is something that MySQL does. It could be something the MySQLDirect .NET provider is doing, and to cover that possibility I've sent an email to their support team. So anyway, here's the scenario. If I run

Re: update query return value

2004-09-20 Thread Brent Baisley
: I'm seeing some odd behavior when I run an UPDATE query, and need to know if this is something that MySQL does. It could be something the MySQLDirect .NET provider is doing, and to cover that possibility I've sent an email to their support team. So anyway, here's the scenario. If I run

Re: update query return value

2004-09-20 Thread Brent Baisley
and update the indexes. It's much more efficient this way. On Sep 20, 2004, at 3:22 PM, Jeff Demel wrote: I'm seeing some odd behavior when I run an UPDATE query, and need to know if this is something that MySQL does. It could be something the MySQLDirect .NET provider is doing, and to cover

Re: update query return value

2004-09-20 Thread Jeff Demel
are updating with the same data, than nothing changes and MySQL doesn't waste the time to lock the table, write the data and update the indexes. It's much more efficient this way. On Sep 20, 2004, at 3:22 PM, Jeff Demel wrote: I'm seeing some odd behavior when I run an UPDATE query, and need

Is this a valid Update Query

2004-09-07 Thread Allen Weeks
Hi All, Is this a valid query and will it achieve the result of appending a carriage return and some text to the current contents of a text type field: Update Atable set Afield = concat(Afield, \n, Some Text) where KeyField = 'keydata' Thanks in advance. Allen -- MySQL General

Re: Is this a valid Update Query

2004-09-07 Thread Mark C. Stafford
On Tue, 7 Sep 2004 15:13:25 -0700, Allen Weeks [EMAIL PROTECTED] wrote: Is this a valid query snip/ Update Atable set Afield = concat(Afield, \n, Some Text) where KeyField = 'keydata' Hi Allen, I notice that you're using both single- and double-quotes. I'm in the habit of using only

Problem with Slow Update Query

2004-08-10 Thread Martin Rytz
Hi all I have a problem with slow update queries like these (5 examples): update url_cat set domain = '01net' where left( domain, instr( domain, '.' ) -1 ) = '01net'; update url_cat set domain = '1-meta' where left( domain, instr( domain, '.' ) -1 ) = '1-meta'; update url_cat set domain =

Re: Problem with Slow Update Query

2004-08-10 Thread SGreen
First create a table with the fixed domain names: CREATE TABLE FixedDomains SELECT DISTINCT domain, left( domain, instr( domain, '.' ) -1 ) as newdomain FROM url_cat Index your new table (for speed): ALTER FixedDomains ADD INDEX (Domain) *** NOTE: You really want to review (and modify, if

Re: Problem with Slow Update Query

2004-08-10 Thread Michael Stassen
An index on domain cannot be used to satisfy your WHERE clause, because you are comparing the result of a function performed on domain to a value. As soon as you feed your column to a function, you lose the use of an index on that column. So, each and every one of these queries performs a

Re: update query question

2004-07-07 Thread SGreen
to: | | Subject: update query question

RE: update query question

2004-07-07 Thread Chris W. Parker
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] on Wednesday, July 07, 2004 11:08 AM said: Have you tried this other way of making an inner join? no i did not because i did know you could do a JOIN on an UPDATE. thanks for your suggestions i will try them out. chris. -- MySQL General Mailing

update query question

2004-07-06 Thread Chris W. Parker
hello, i've had to change some of the tables in my db to accomodate some greater flexibility in the application that uses it and because of this i need to go through and update all the records. i've done one table by hand and it had about 100 records and took about 20 minutes. but this next table

GRANT update query: Updating host access entry for users but retaining existing passwords

2003-09-30 Thread Shin
Hi, I've got a MYSQL 3.23.x setup that has approx 4000 database and 4000 user accounts. 1 database per user. I created each userid from a script of the form CREATE DATABASE mdb_userid; GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, INDEX,RELOAD ON mdb_userid.* TO [EMAIL PROTECTED]

RE: GRANT update query: Updating host access entry for users but retaining existing passwords

2003-09-30 Thread Andy Eastham
: GRANT update query: Updating host access entry for users but retaining existing passwords Hi, I've got a MYSQL 3.23.x setup that has approx 4000 database and 4000 user accounts. 1 database per user. I created each userid from a script of the form CREATE DATABASE mdb_userid; GRANT SELECT

Re: GRANT update query: Updating host access entry for users but retaining existing passwords

2003-09-30 Thread Shin
Hi, Thanks for the followup/reply. On Tue, Sep 30, 2003 at 01:56:11PM +0100, Andy Eastham wrote: I've never tried this, so it's pure speculation, but I believe all of the grant information is contained in a regular table called user. I had a look into this and it seems that some of the

Re: Getting the primary key in an update query

2003-09-10 Thread Roger Baklund
* Daniel Rossi Hi there i was wondering if there was anyway to determine the primary key field instead of explicitly setting it in an update sql query ? for instance i'd like to go update table *** where primarykey=1 instead of where id=1 as the primary key is named differentrly for each

Re: Getting the primary key in an update query

2003-09-10 Thread Daniel Rossi
that works cheers Roger Baklund [EMAIL PROTECTED] 09/11/03 10:48am * Daniel Rossi Hi there i was wondering if there was anyway to determine the primary key field instead of explicitly setting it in an update sql query ? for instance i'd like to go update table *** where primarykey=1

Possible: Update query within another query's loop?

2003-08-28 Thread Mark Richards
I am still quite new to MySQL and have a basic question. I am using PHP, so forgive me if this is more a PHP issue. I want to perform an update to a specific record based on a condition. In the outer loop, I have Query1, which returns set Result1. Inside this loop, I run an UPDATE query which

Re: Possible: Update query within another query's loop?

2003-08-28 Thread Antony Dovgal
Query1, which returns set Result1. Inside this loop, I run an UPDATE query which returns Result2. // executed first query... while ($row = mysql_fetch_assoc($result1)) { // get the record ID for the row we are on. $recid = $row[id]; // construct a new query

Possible: Update query within another query's loop?

2003-08-28 Thread Mark Richards
I am still quite new to MySQL and have a basic question. I am using PHP, so forgive me if this is more a PHP issue. I want to perform an update to a specific record based on a condition. In the outer loop, I have Query1, which returns set Result1. Inside this loop, I run an UPDATE query

Re: Possible: Update query within another query's loop?

2003-08-28 Thread Fred van Engen
, which returns set Result1. Inside this loop, I run an UPDATE query which returns Result2. // executed first query. while ($row = mysql_fetch_assoc($result1)) { // get the record ID for the row we are on. $recid = $row[id]; // construct a new query

Re: Possible: Update query within another query's loop?

2003-08-28 Thread Antony Dovgal
On Thu, 28 Aug 2003 16:23:35 +0200 Fred van Engen [EMAIL PROTECTED] wrote: You need to make a separate connection to MySQL for the outer query to prevent the inner query from messing up the outer query's result set. See the PHP manual for obtaining the connection id's from mysql_connect and

Re: Possible: Update query within another query's loop?

2003-08-28 Thread Fred van Engen
Antony, On Thu, Aug 28, 2003 at 06:29:54PM +0400, Antony Dovgal wrote: On Thu, 28 Aug 2003 16:23:35 +0200 Fred van Engen [EMAIL PROTECTED] wrote: You need to make a separate connection to MySQL for the outer query to prevent the inner query from messing up the outer query's result set.

Re: Possible: Update query within another query's loop?

2003-08-28 Thread Antony Dovgal
On Thu, 28 Aug 2003 16:37:41 +0200 Fred van Engen [EMAIL PROTECTED] wrote: Please elaborate. I've already answered: On Thu, 28 Aug 2003 17:07:19 +0400 Antony Dovgal [EMAIL PROTECTED] wrote: You don't need execute UPDATE's in the loop in this case. Try smthing like that: ? . $ids =

RE: Possible: Update query within another query's loop?

2003-08-28 Thread Mark Richards
data the other is dependent on :) Thanks for the great idea. -m- -Original Message- From: Antony Dovgal [mailto:[EMAIL PROTECTED] Sent: Thursday, August 28, 2003 10:30 To: [EMAIL PROTECTED] Subject: Re: Possible: Update query within another query's loop? On Thu, 28 Aug 2003 16:23:35

Re: Possible: Update query within another query's loop?

2003-08-28 Thread Fred van Engen
Antony, On Thu, Aug 28, 2003 at 06:45:27PM +0400, Antony Dovgal wrote: On Thu, 28 Aug 2003 16:37:41 +0200 Fred van Engen [EMAIL PROTECTED] wrote: Please elaborate. I've already answered: On the list I just saw your 'bad advice' message without explanation. On Thu, 28 Aug 2003

Possible: Update query within another query's loop?

2003-08-27 Thread Mark Richards
I am still quite new to MySQL and have a basic question. I am using PHP, so forgive me if this is more a PHP issue. I want to perform an update to a specific record based on a condition. In the outer loop, I have Query1, which returns set Result1. Inside this loop, I run an UPDATE query which

update query using inner join on same table

2003-07-23 Thread Jonathan Patton
Hi, I have a query that runs in Microsoft Access against my mysql database just fine. It is: UPDATE discussion_categories AS discussion_categories_1 INNER JOIN discussion_categories ON discussion_categories_1.parent_1_text = discussion_categories.name SET discussion_categories_1.parent_1

RE: update query using inner join on same table

2003-07-23 Thread Jonathan Patton
I answered my own question, this works for joining a table on itself and doing an update query: update discussion_categories discussion_categories1, discussion_categories set discussion_categories1.parent_1 = discussion_categories.category_id where

Re: update query using inner join on same table

2003-07-23 Thread Victoria Reznichenko
Jonathan Patton [EMAIL PROTECTED] wrote: I have a query that runs in Microsoft Access against my mysql database just fine. It is: UPDATE discussion_categories AS discussion_categories_1 INNER JOIN discussion_categories ON discussion_categories_1.parent_1_text =

Re: Update query with substring

2003-06-02 Thread Paul DuBois
SQL syntax near ' table2 SET table1.periode = table2.periode WHERE table1.id = 3 AND SUBSTRIN' at line 1 Is it possible to use a SUBSTRING_INDEX in a update query, or what i am i doing wrong? That's not what the error message is telling you. It's complaining about the second table name prior

RE: Update query with substring

2003-06-02 Thread jbonnett
You can't have two tables in the UPDATE query, at least not in v3.x of MySQL. I'm not sure about version 4. That's why it's complaining about table2. I think the SUBSTRING_INDEX should be OK. You may have to split your query into a series of queries. There is some guidance in the MySQL manual

  1   2   >