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

Deadlocks with High Concurrency SELECT FOR UPDATE

2007-10-15 Thread William Newton
| 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 number of concurrent connections (around 200), when I

SQL for Subversion update-report

2007-10-03 Thread Jack Bates
I'm working on a Subversion interface to MediaWiki and am struggling with the SQL to respond to Subversion's update-report: http://www.mediawiki.org/wiki/WebDAV MediaWiki's revision table contains unique revision ids and the corresponding page id. The page table contains unique page ids

timestamp for update and insert

2007-09-04 Thread Hiep Nguyen
lastupdated fields when i insert a record and only lastupdated when i update the record? thanks, T. Hiep -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Re: timestamp for update and insert

2007-09-04 Thread Olaf Stein
I would use a trigger (at least for the update) The first insert should work with now() and you can leave lastupdateted empty Olaf On 9/4/07 3:01 PM, Hiep Nguyen [EMAIL PROTECTED] wrote: Hi list, i tried to create a table with inserted lastupdated timestamp fields: create table

Re: timestamp for update and insert

2007-09-04 Thread Michael Dykman
for the update) The first insert should work with now() and you can leave lastupdateted empty Olaf On 9/4/07 3:01 PM, Hiep Nguyen [EMAIL PROTECTED] wrote: Hi list, i tried to create a table with inserted lastupdated timestamp fields: create table temp ( id int not null

Re: timestamp for update and insert

2007-09-04 Thread Olaf Stein
about it. - michael On 9/4/07, Olaf Stein [EMAIL PROTECTED] wrote: I would use a trigger (at least for the update) The first insert should work with now() and you can leave lastupdateted empty Olaf On 9/4/07 3:01 PM, Hiep Nguyen [EMAIL PROTECTED] wrote: Hi list, i

Re: timestamp for update and insert

2007-09-04 Thread Hiep Nguyen
, Olaf Stein [EMAIL PROTECTED] wrote: I would use a trigger (at least for the update) The first insert should work with now() and you can leave lastupdateted empty Olaf On 9/4/07 3:01 PM, Hiep Nguyen [EMAIL PROTECTED] wrote: Hi list, i tried to create a table with inserted lastupdated

Re: timestamp for update and insert

2007-09-04 Thread Michael Dykman
() and then count on the built-in properties to see the first one updated on every UPDATE. The only other caveats are: your application behaviour is now dependent on the ordering of columns; ok in the short-term, increasingly annoying over time as maintainence phases grow the app in complexity

RE: timestamp for update and insert

2007-09-04 Thread Daevid Vincent
Just do this... create table temp ( id int not null primary key auto_increment, data varchar(100), inserted timestamp default 0, lastupdated default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ); And just use Insert into temp (inserted ) values (NOW()); You're only inserting once, so

Re: timestamp for update and insert

2007-09-04 Thread Hiep Nguyen
statement is specifically designed to set the *second* timestamp field to now() and then count on the built-in properties to see the first one updated on every UPDATE. The only other caveats are: your application behaviour is now dependent on the ordering of columns; ok in the short-term

Re: timestamp for update and insert

2007-09-04 Thread Olaf Stein
that you have to make sure that every insert statement is specifically designed to set the *second* timestamp field to now() and then count on the built-in properties to see the first one updated on every UPDATE. The only other caveats are: your application behaviour is now dependent

Update error on ver 3.23, works on ver 5.0

2007-08-02 Thread Tim Johnson
Hi: I use 5.0.38 on my ubuntu desktop and I have to work with ver 3.23.56 on a solaris-based server. The following update query: UPDATE wine_list,FRED SET wine_list.wine_ID=FRED.WMJ_ID WHERE wine_list.wine_ID=FRED.wine_ID; works on 5.038, but on 3.23.56 I get the following: ERROR 1064 (0

Re: Update error on ver 3.23, works on ver 5.0

2007-08-02 Thread Baron Schwartz
Hi, Tim Johnson wrote: Hi: I use 5.0.38 on my ubuntu desktop and I have to work with ver 3.23.56 on a solaris-based server. The following update query: UPDATE wine_list,FRED SET wine_list.wine_ID=FRED.WMJ_ID WHERE wine_list.wine_ID=FRED.wine_ID; works on 5.038, but on 3.23.56 I get

Re: Update error on ver 3.23, works on ver 5.0

2007-08-02 Thread Tim Johnson
On Thursday 02 August 2007, Tim Johnson wrote: Hi: I use 5.0.38 on my ubuntu desktop and I have to work with ver 3.23.56 on a solaris-based server. The following update query: UPDATE wine_list,FRED SET wine_list.wine_ID=FRED.WMJ_ID WHERE wine_list.wine_ID=FRED.wine_ID; works on 5.038

User variables in update statement

2007-07-10 Thread Scott Haneda
Is it possible to use user variables in an update statement, I can find only scant docs on it, but they do not pertain to what I am trying to do. Given this select: SELECT user_id, order_status, quantity_chosen, month_price, each_price, sales_tax, sales_tax_rate, @NEW_each_price:=(each_price

Re: User variables in update statement

2007-07-10 Thread Baron Schwartz
Hi Scott, Scott Haneda wrote: Is it possible to use user variables in an update statement, I can find only scant docs on it, but they do not pertain to what I am trying to do. Given this select: SELECT user_id, order_status, quantity_chosen, month_price, each_price, sales_tax, sales_tax_rate

Interresting update problem

2007-06-27 Thread Mogens Melander
Hi all, I'm trying to wrap my brain around folowing problem. table main(code, field_1, field_2, field_3, , , field_51) 111, 'X', '', 'X',,, 222, '', '', 'X',,, 333, '', 'X', '' ,,, 444, '', '', '' ,,, 555, 'X','X', '' ,,, table map(id, field) 1, 'field_1' 5, 'field_2' 9, 'field_3'

Re: Interresting update problem

2007-06-27 Thread Dan Buettner
What I've done in situations like this is write SQL that generates the SQL I need. I then pipe out to a file and pipe it back in, or just pipe from one instance of mysql to another. Example SQL: SELECT CONCAT('UPDATE main SET ', field, ' = ', id, ';') AS update_sql FROM map Example command

DB - Data update for Dev server

2007-06-09 Thread David Lazo
Hello all, I think I saw this on an earlier post but I can't find it now. What I need to do: 1 - update data nightly into Dev Server 2 - only copy Data do not overwrite structure 3 - only update specific tables Any advice is greatly appreciated. David -- MySQL General Mailing List For list

Problem with UPDATE

2007-06-03 Thread Haig (Home)
Hi everyone, I have a form where you fill out description from a textarea and on submit, it updates description in mytable. This works fine. I want to also add the current date into description in my table. Here's what I get: $date = date (F d Y); $sql = UPDATE mytable SET description

RE: INSERT ... ON DUPLICATE KEY UPDATE seems so close and yet so far...

2007-04-30 Thread Daevid Vincent
for the hit or the id, etc.) Perhaps I'm wrong here, but my suggestion should still work wouldn't it? insert into table1 (hits) values (hits+1) on duplicate key update; So on a new record, all columns inserted as defaults. hits is 0, then incremented to 1. On an updated record, hits is just incremented

INSERT ... ON DUPLICATE KEY UPDATE seems so close and yet so far...

2007-04-27 Thread Daevid Vincent
instead of this cumbersome incantation that makes you want to rip out your hair and puch your cube-mate dead in the nose: insert into table1 (c1,c2,c3) values (v1,v2,v3) on duplicate key update c1=v1, c2=v2, c3=v3; Just allow a more sane and logical: insert into table1 (c1,c2,c3) values (v1,v2

Re: INSERT ... ON DUPLICATE KEY UPDATE seems so close and yet so far...

2007-04-27 Thread Philip Hallstrom
instead of this cumbersome incantation that makes you want to rip out your hair and puch your cube-mate dead in the nose: insert into table1 (c1,c2,c3) values (v1,v2,v3) on duplicate key update c1=v1, c2=v2, c3=v3; Just allow a more sane and logical: insert into table1 (c1,c2,c3) values (v1,v2,v3

Re: Update question

2007-04-26 Thread Jørn Dahl-Stamnes
On Wednesday 25 April 2007 23:14, you wrote: try this: update table1, table2 set table1.value = table2.value where table1.id = table2.id Thanks for the replies... It was late evening when I tried to figure out how to do this. Today I found the answer myself, which is exactly as described

Update question

2007-04-25 Thread Jørn Dahl-Stamnes
Please, I nedd help!! I have two tabels: table1: id value table2: id value Both tables has a lot of records with identical IDs. I need to update the table1.value with the table2.value where the id are identical. But I cannot find any UPDATE query that can do

Re: Update question

2007-04-25 Thread Mogens Melander
On Wed, April 25, 2007 23:10, Jørn Dahl-Stamnes wrote: Please, I nedd help!! I have two tabels: table1: id value table2: id value Both tables has a lot of records with identical IDs. I need to update the table1.value with the table2.value where the id

UPDATE and INSERT in one

2007-04-20 Thread lists
Hi, I want to update a table if it meets some conditions (already exist) and INSERT otherwise? Right now I am doing it this way: 1. SELECT the record 2. If it exist, I UPDATE it 3. If it does not exit, I INSERT a new record Could this be done in one query? I mean like conditional update

Re: UPDATE and INSERT in one

2007-04-20 Thread Johan Höök
Hi, what you want to look into is (depending on your version) either INSERT ... ON DUPLICATE KEY UPDATE ... or REPLACE http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html http://dev.mysql.com/doc/refman/5.0/en/replace.html /Johan [EMAIL PROTECTED] skrev: Hi, I want to update

Re: UPDATE and INSERT in one

2007-04-20 Thread David Precious
[EMAIL PROTECTED] wrote: I want to update a table if it meets some conditions (already exist) and INSERT otherwise? Right now I am doing it this way: 1. SELECT the record 2. If it exist, I UPDATE it 3. If it does not exit, I INSERT a new record Could this be done in one query? I mean like

Re: UPDATE and INSERT in one

2007-04-20 Thread wang shuming
insert into table1 (fa,fb,qty) values (fa1,fb1,qty1) on duplicate key update qty=qty+qty1 a primarykey or unique key must. Shuming Wang

Is it possible to either update or insert in a single query?

2007-04-13 Thread Douglas Pearson
Apologies if this is a dumb question, but is it possible to write a single query that either updates certain columns in a row, or adds an entirely new row if there is none already? I seem to be running into this a lot, and so far I've solved it by: 1) run UPDATE table SET x,y WHERE some row 2

Re: Is it possible to either update or insert in a single query?

2007-04-13 Thread Carlos Proal
seem to be running into this a lot, and so far I've solved it by: 1) run UPDATE table SET x,y WHERE some row 2) if rowsChanged == 0 then run the INSERT It just feels like there must be a way to do this more efficiently. Thanks, Doug -- MySQL General Mailing List For list archives: http

Re: Is it possible to either update or insert in a single query?

2007-04-13 Thread Mogens Melander
is a MySQL extension to the SQL standard. It either inserts, or deletes and inserts. For another MySQL extension to standard SQL — that either inserts or updates — see Section 13.2.4.3, “INSERT ... ON DUPLICATE KEY UPDATE Syntax”. Note that unless the table has a PRIMARY KEY or UNIQUE index, using

Re: Is it possible to either update or insert in a single query?

2007-04-13 Thread Martijn Tonies
REPLACE is a MySQL extension to the SQL standard. It either inserts, or deletes and inserts. For another MySQL extension to standard SQL — that either inserts or updates — see Section 13.2.4.3, “INSERT ... ON DUPLICATE KEY UPDATE Syntax”. Take note!! If you're using triggers, foreign key

RE: Is it possible to either update or insert in a single query?

2007-04-13 Thread Price, Randall
BEGIN UPDATE myTable SET . END; END IF; END; Randall Price Secure Enterprise Technology Initiatives Microsoft Implementation Group Virginia Tech Information Technology -Original Message- From: Douglas Pearson [mailto:[EMAIL PROTECTED] Sent: Friday, April 13, 2007 2:14

RE: Is it possible to either update or insert in a single query?

2007-04-13 Thread Douglas Pearson
Thanks Mogens. I was aware of REPLACE but it was the non-standard ON DUPLICATE KEY UPDATE that I was looking for. Thanks, Doug -Original Message- From: Mogens Melander [mailto:[EMAIL PROTECTED] Sent: Friday, April 13, 2007 2:28 AM To: Douglas Pearson Cc: [EMAIL PROTECTED] Subject: Re

Join update help

2007-04-11 Thread Ravi Kumar.
(logintime) from T2 for each user. How do I do this? I tried variants of this: update T1, T2 set last_login_time = max(logintime) where T1.userid = T2.userid. Thanks Ravi. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com

RE: Join update help

2007-04-11 Thread Jerry Schwartz
I think you want a subquery. Something like UPDATE t1 SET last_login_time = (SELECT MAX(logintime) FROM t2 WHERE t1.userid = t2.userid); would be a good start. Regards, Jerry Schwartz Global Information Incorporated 195 Farmington Ave. Farmington, CT 06032 860.674.8796 / FAX: 860.674.8341

UPDATE / not UPDATE??

2007-04-02 Thread Jesse
When I run the query: UPDATE InvHead I JOIN (SELECT InvNo,Sum(Rate + CASE WHEN AttendingAcademy=1 THEN 30 ELSE 0 END) AS InvTot FROM Participants P GROUP BY InvNo) AS PartSum ON PartSum.InvNo=I.InvNo SET I.Total=PartSum.InvTot WHERE (I.InvoiceType='CL' OR I.InvoiceType='CSS

Re: UPDATE / not UPDATE??

2007-04-02 Thread Jesse
Don't know? 5.0.22-community-nt-log Win XP Pro InnoDB Jesse - Original Message - From: sol beach To: Jesse Sent: Monday, April 02, 2007 4:22 PM Subject: Re: UPDATE / not UPDATE?? Might this behavior be version dependent; which you neglected to provide. Same for OS name

RE: UPDATE / not UPDATE??

2007-04-02 Thread Jerry Schwartz
Subject: UPDATE / not UPDATE?? When I run the query: UPDATE InvHead I JOIN (SELECT InvNo,Sum(Rate + CASE WHEN AttendingAcademy=1 THEN 30 ELSE 0 END) AS InvTot FROM Participants P GROUP BY InvNo) AS PartSum ON PartSum.InvNo=I.InvNo SET I.Total=PartSum.InvTot WHERE (I.InvoiceType='CL

What's the fastest way to update a table from another table?

2007-03-15 Thread mos
I have 2 tables and I need to update Table1 with the rows from table 2. They have 15 columns that need updating (that are in both tables). Now I could delete the old rows from table1, except there are around 1 million rows, from a 35 million row table. This takes too long. I'd like to update

The UPDATE efficiency is too slow when c overing multiple tables

2007-03-08 Thread lm761104
I run a SQL statement about UPDATE covering multiple tables, i feel that it is too slowly. SQL statement: update b_bb,tempdb set b_bb.zrk1=tempdb.num where b_bb.dwdm=concat(tempdb.shengbm,tempdb.shibm,tempdb.xianbm,tempdb.xiangbm,tempdb.cunbm); I modify the JOIN syntax like this: update

RE: Best update strategy with MyISAM

2007-03-03 Thread mos
AB -Original Message- From: mos [mailto:[EMAIL PROTECTED] Sent: Friday, March 02, 2007 7:39 AM To: mysql@lists.mysql.com Subject: Best update strategy with MyISAM I will have an application that will have 1000 20 row selects executed every second. The application will also

Best update strategy with MyISAM

2007-03-02 Thread mos
on the machine and InnoDb is too slow if the table doesn't fit into memory. With MyISAM: 1) Will the updates block the Select statements from executing? If so, is there a way around it? I don't want to stop the Select's from executing by having them wait for an update lock to complete. 2) Is it better

RE: Best update strategy with MyISAM

2007-03-02 Thread Gary W. Smith
-- Axel Schwenke, Senior Software Developer, MySQL AB -Original Message- From: mos [mailto:[EMAIL PROTECTED] Sent: Friday, March 02, 2007 7:39 AM To: mysql@lists.mysql.com Subject: Best update strategy with MyISAM I will have an application that will have 1000 20 row selects

what's better query to update table

2007-02-26 Thread afan
the rating 2-3 times a month, it's not big deal, but I would like to know what is correct solution: have a three queries, e.g.: mysql_query( update suppliers set rating='R' where supp_id=1 or supp_id=5 or supp_id=8 or supp_id=23 or ... or supp_id=1786); mysql_query( update suppliers

RE: what's better query to update table

2007-02-26 Thread Jerry Schwartz
, $thislen - 1); } $query = update suppliers set rating='A' where supp_id IN (${rating_list[A]}); ... And so forth. Regards, Jerry Schwartz Global Information Incorporated 195 Farmington Ave. Farmington, CT 06032 860.674.8796 / FAX: 860.674.8341 -Original Message- From: [EMAIL PROTECTED

Re: sum with update

2007-02-19 Thread ViSolve DB Team
Hi, Yes it is possible to use sum with Update, subject to the constraint -table to be updated must not present in the FROM clause of the select stmt. But in your query, the table to be updated is present in the FROM clause. Hence update doesn't support that and have to go for some procedures

Re: Update multiple tables strange behaviour

2007-02-19 Thread Manuel Vacelet
2007/2/15, Manuel Vacelet [EMAIL PROTECTED]: Hi all, I'm facing a strange behaviour with an UPDATE statement. I have a table like: +-+--+ | item_id | rank | +-+--+ |2812 |2 | | 13050 |4 | | 13051 |3 | | 13052 |1 | +-+--+ And I want

sum with update

2007-02-17 Thread Ahmad Al-Twaijiry
Hi Everyone I have a question regarding SUM and Update. is it possible to use SUM with Update ? for example I have 3 tables table_1: idT1 Price 120 230 350 420 table_2: idCust Total

Update multiple tables strange behaviour

2007-02-15 Thread Manuel Vacelet
Hi all, I'm facing a strange behaviour with an UPDATE statement. I have a table like: +-+--+ | item_id | rank | +-+--+ |2812 |2 | | 13050 |4 | | 13051 |3 | | 13052 |1 | +-+--+ And I want to switch items 2812 and 13052 rank (i.e

Re: Update failing with error 1062

2007-02-14 Thread Simon Giddings
Found the source of my problem. I had an update trigger connected to this table which was trying to create a new entry in another table instead of updating an existing one! There we go! Simon -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http

Re: Update failing with error 1062

2007-02-13 Thread Simon Giddings
something. The only condition I can think of off the top of my head which might do that is if you have another unique key in your structure and that is the one this error is complaining about. On 2/12/07, Simon Giddings [EMAIL PROTECTED] wrote: Good morning, I issue an update statement containing

Update failing with error 1062

2007-02-12 Thread Simon Giddings
Good morning, I issue an update statement containing a where clause on the primary index, so as to update a single record. Howerver this is failing with Duplicate entry '6' for key 1 - update clients.calendarentry set Subject = 'presentation' where idCalendarEntry = 6; In the table

Fw: Update failing with error 1062

2007-02-12 Thread Devi
- Original Message - From: Devi [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: Monday, February 12, 2007 5:34 PM Subject: Re: Update failing with error 1062 Hi MySQLeers, How can I setup multiple daemons, One daemon for one database? So that they can act independenly. What

Re: Update failing with error 1062

2007-02-12 Thread Devi
Hi MySQLeers, How can I setup multiple daemons, One daemon for one database? So that they can act independenly. What might be the pitfalls over here? In what situation one can opt for multiple daemons? What about maximum_connections. Is it for all the server instances? Thanks DEVI. G

Re: Update failing with error 1062

2007-02-12 Thread Michael Dykman
[EMAIL PROTECTED] wrote: Good morning, I issue an update statement containing a where clause on the primary index, so as to update a single record. Howerver this is failing with Duplicate entry '6' for key 1 - update clients.calendarentry set Subject = 'presentation' where idCalendarEntry = 6

Merge tables and ON DUPLICATE KEY UPDATE

2007-02-12 Thread Kevin Burton
I want to use a merge table so that I can direct all new INSERTs to a new merge table and migrate old data off the system by having a continually sliding window of underlying MyISAM tables. The problem is that of I do INSERT ... ON DUPLCATE KEY UPDATE and that value isn't in the leading table

Re: Merge tables and ON DUPLICATE KEY UPDATE

2007-02-12 Thread Jay Pipes
Kevin Burton wrote: I want to use a merge table so that I can direct all new INSERTs to a new merge table and migrate old data off the system by having a continually sliding window of underlying MyISAM tables. The problem is that of I do INSERT ... ON DUPLCATE KEY UPDATE and that value isn't

Re: Merge tables and ON DUPLICATE KEY UPDATE

2007-02-12 Thread Kevin Burton
... ON DUPLCATE KEY UPDATE and that value isn't in the leading table where all INSERTs go a *new* row will be created. Is there any way around this problem? What about using partitioning in MySQl 5.1+? Would this work? http://dev.mysql.com/doc/refman/5.1/en/partitioning.html Cheers, Jay

Re: Multiple-table UPDATE unexpected result

2007-02-09 Thread ViSolve DB Team
Hi, Try this, mysql update atable,btable set atable.b=atable.b+(select sum(b) from btable where btable.a=atable.a) where atable.a=btable.a; mysql select * from atable; +--+--+ | a| b| +--+--+ | 1| 10 | | 2| 15 | | 3| 23 | | 4| 10

Multiple-table UPDATE unexpected result

2007-02-08 Thread Thomas Spahni
Dear listmembers On mysql version 4.1.13 I execute a query of this type: UPDATE a LEFT JOIN b ON a.col = b.col SET a.x = a.x + b.y WHERE b.col IS NOT NULL; I expect that column a.x is updated for every match in the join but this is not the case. Table a is updated for the first match only

problem with update innodb table

2007-02-08 Thread Alicia Amadoz
Hello, I am trying to update two fields of a table that are a composed foreign key to another table. These fields cant be updated with this kind of warning: Warning | 1292 | Truncated incorrect DOUBLE value: 'A05' Both tables are InnoDB and I have tried with all types of constraints, ON UPDATE

Re: problem with update innodb table

2007-02-08 Thread Olexandr Melnyk
Posting you table difinitions and queries would be helpful. Olexandr Melnyk, http://omelnyk.net/ 2007/2/8, Alicia Amadoz [EMAIL PROTECTED]: Hello, I am trying to update two fields of a table that are a composed foreign key to another table. These fields cant

Re: problem with update innodb table

2007-02-08 Thread Alicia Amadoz
and then updating this field in the referencing table. Once this field has been updated, then I perform an update to the second field in the referencing table. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

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 queries

2007-02-02 Thread Jerry Jones
I need to run a query that will take the data from item_number field, add -1.jpg to the end of it, and store it in image_location I have tried update inventory_items set image_location = item_number + -1.jpg; but that just places the item number into the field, without the text in quotes. How do

Re: Update queries

2007-02-02 Thread ViSolve DB Team
Try using CONCAT() ; mysql update inventory_items set image_location=concat(item_number,'-1.jpg'); Thanks ViSolve DB Team. - Original Message - From: Jerry Jones [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: Saturday, February 03, 2007 12:00 PM Subject: Update queries I need

Re: Table update

2007-01-20 Thread Jørn Dahl-Stamnes
On Saturday 20 January 2007 05:52, ViSolve DB Team wrote: Hi Update will never support group by clause, only supports group functions; Try as: Update teams t inner join rider_team as rt on (rt.team_id=t.id) inner join participants as p on (p.rider_id=rt.rider_id

Re: Table update

2007-01-19 Thread ViSolve DB Team
Hi Update will never support group by clause, only supports group functions; Try as: Update teams t inner join rider_team as rt on (rt.team_id=t.id) inner join participants as p on (p.rider_id=rt.rider_id) inner join races as r on (r.id=p.race_id) set

RE: Does Update allow for aliases?

2007-01-17 Thread Jonathan Langevin
I concede to the MySQL engineer :-) -Original Message- From: Shawn Green [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 10, 2007 3:30 PM To: Jonathan Langevin Cc: Chris White; Richard Reina; mysql@lists.mysql.com Subject: Re: Does Update allow for aliases? Hi all, Multi-table

Table update

2007-01-17 Thread Jørn Dahl-Stamnes
I want to update new column in a table with data from other tables. The following query give me the data: select t.id,min(r.starttime) from teams as t inner join rider_team as rt on (rt.team_id=t.id) inner join participants as p on (p.rider_id=rt.rider_id) inner join races as r

Re: Multiple table updates (Was: Does Update allow for aliases)

2007-01-11 Thread Brent Baisley
The key part of the documentation for me was: - Original Message - From: Chris White [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: Wednesday, January 10, 2007 12:55 PM Subject: Multiple table updates (Was: Does Update allow for aliases) Reading the noted previous thread, I

Re: Multiple table updates (Was: Does Update allow for aliases)

2007-01-11 Thread Brent Baisley
The key part of the UPDATE documentation for me was: The table_references clause lists the tables involved in the join. Its syntax is described in Section 13.2.7.1, JOIN Syntax. Basically you can take almost any SELECT statement with JOINs and convert it to an UPDATE. There are certain

Does Update allow for aliases?

2007-01-10 Thread Richard Reina
I am trying to update from one table to another but I get a syntax error when I try: UPDATE from maindb.orders o, altdb.orders ao SET o.price=ao.price WHERE o.ID=a.ID; If update does not support aliases, is there another way to do this query? I am usin V3.23.54. Any help would

Re: Does Update allow for aliases?

2007-01-10 Thread Chris White
Richard Reina wrote: I am trying to update from one table to another but I get a syntax error when I try: UPDATE from maindb.orders o, altdb.orders ao SET o.price=ao.price WHERE o.ID=a.ID; First off, it'd be best if possible (I know some cases prevent it) to upgrade your server

Re: Does Update allow for aliases?

2007-01-10 Thread Nils Meyer
Hi Richard, Richard Reina wrote: I am trying to update from one table to another but I get a syntax error when I try: UPDATE from maindb.orders o, altdb.orders ao SET o.price=ao.price WHERE o.ID=a.ID; If update does not support aliases, is there another way to do this query? I am usin

Multiple table updates (Was: Does Update allow for aliases)

2007-01-10 Thread Chris White
Reading the noted previous thread, I was curious as to updating multiple tables. I read the MySQL docs, which mentions that you can do it: Multiple-table syntax: UPDATE [LOW_PRIORITY] [IGNORE] /|table_references|/ SET /|col_name1|/=/|expr1|/ [, /|col_name2|/=/|expr2|/ ...] [WHERE

RE: Does Update allow for aliases?

2007-01-10 Thread Jonathan Langevin
The proper syntax would need to be: UPDATE maindb.orders o, altdb.orders ao SET o.price=ao.price WHERE o.ID=a.ID; The only problem is the existence of the from. That being said, an UPDATE ... JOIN likely doesn't work under MySQL 3 -Original Message- From: Chris White [mailto:[EMAIL

Re: Does Update allow for aliases?

2007-01-10 Thread Shawn Green
Langevin wrote: The proper syntax would need to be: UPDATE maindb.orders o, altdb.orders ao SET o.price=ao.price WHERE o.ID=a.ID; snip The second table is aliased to 'ao' not 'a': UPDATE maindb.orders o, altdb.orders ao SET o.price=ao.price WHERE o.ID=ao.ID; ^^ Look here

Re: Does Update allow for aliases?

2007-01-10 Thread ViSolve DB Team
Hi Reina, Try like: mysql UPDATE maindb o,altdb ao set o.price =ao.price where o.id=ao.id; This will do good. Thanks ViSolve DB Team - Original Message - From: Richard Reina [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: Wednesday, January 10, 2007 10:08 PM Subject: Does

Need SUPER Privilidge for UPDATE?

2007-01-08 Thread Jesse
I have an ASP.NET app where I'm doing an update, and the user name that I'm using has the access to do an update. When I execute this command, I get the error, #42000Access denied; you need the SUPER privilege for this operation. Following is my query: UPDATE Families SET LastName

Re: Need SUPER Privilidge for UPDATE?

2007-01-08 Thread Mark Leith
Hi Jesse wrote: I have an ASP.NET app where I'm doing an update, and the user name that I'm using has the access to do an update. When I execute this command, I get the error, #42000Access denied; you need the SUPER privilege for this operation. Following is my query: UPDATE Families SET

Re: Need SUPER Privilidge for UPDATE?

2007-01-08 Thread Jesse
Sounds like you have triggers on the table, see the DEFINER clause within this section of the manual: http://dev.mysql.com/doc/refman/5.0/en/create-trigger.html Triggers within 5.0 require the user (within the DEFINER clause, or executing the statement against the table when using

Re: On Duplicate Key Update question

2007-01-06 Thread ViSolve DB Team
Hi, From your query, understood that you want to retain old qty and new qty; result in another field. Try with, INSERT INTO TABLE1 (id,newqty) values (6,300) ON DUPLICATE KEY UPDATE totqty=oldqty+newqty, oldqty=newqty; Thanks, ViSolve DB Team - Original Message - From: Ed Reed

On Duplicate Key Update question

2007-01-05 Thread Ed Reed
I use On Duplicate Key Update a lot and I usually use it like this, Insert Into tablename (myID, Qty) Values (1034,15), (6,13), (5001,1), (145,20) On Duplicate Key Update Qty=Values(Qty); This works very well but now I'd like to do something a little different. I'd like to have a query like

Re: On Duplicate Key Update question

2007-01-05 Thread Ed Reed
Sorry for the premature question. I think I figured it out. On Duplicate Key Update Qty=Qty+Values(Qty); I haven't tested it yet but it makes sense that it'll work. Ed Reed [EMAIL PROTECTED] 1/5/07 2:40 PM I use On Duplicate Key Update a lot and I usually use it like this, Insert

Re: On Duplicate Key Update question

2007-01-05 Thread Chris W
Ed Reed wrote: I use On Duplicate Key Update a lot and I usually use it like this, Insert Into tablename (myID, Qty) Values (1034,15), (6,13), (5001,1), (145,20) On Duplicate Key Update Qty=Values(Qty); This works very well but now I'd like to do something a little different. I'd like to have

Question regarding Update ... LEFT JOIN

2007-01-03 Thread Jonathan Langevin
I've used the syntax, UPDATE ... LEFT JOIN a few times in the past, and today I used it again for a new employer that I work for. Several of my associates were unaware that the UPDATE ... LEFT JOIN syntax is valid in MySQL. After I demonstrated that the query does indeed work fine on our MySQL 5

RE: Question regarding Update ... LEFT JOIN

2007-01-03 Thread Jerry Schwartz
Incorporated 195 Farmington Ave. Farmington, CT 06032 860.674.8796 / FAX: 860.674.8341 -Original Message- From: Jonathan Langevin [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 03, 2007 4:13 PM To: mysql@lists.mysql.com Subject: Question regarding Update ... LEFT JOIN I've used

RE: Question regarding Update ... LEFT JOIN

2007-01-03 Thread Jonathan Langevin
; mysql@lists.mysql.com Subject: RE: Question regarding Update ... LEFT JOIN I hope it is locking both tables. Even if you aren't changing any fields in the right-hand column, you don't want anyone changing it under you. I hope that, if you aren't actually modifying the right-hand table, that MySQL uses

RE: Question regarding Update ... LEFT JOIN

2007-01-03 Thread Jonathan Langevin
Just a thought, if I were to JOIN or reference a SUBQUERY instead, inside the UPDATE statement, would that lessen the length of time for a SELECT lock? From what I understand, subqueries get temporarily cached as a temp table, so theoretically it would be a way to avoid locks, no? (or, reduce

find date an time of a table update

2006-12-21 Thread Marcelo Fabiani
Hi, I didn't find a way to know the time and date of the last update of table, not the data but the table info itself. Is this possible? I want to use this info in order to show it in a web page. Mysql 4.1 Apache Myisam Regards Marcelo Fabiani -- MySQL General Mailing List For list

Re: find date an time of a table update

2006-12-21 Thread ViSolve DB Team
: Check the user privilege to access the database. If not grant it. Thanks ViSolve DB Team. - Original Message - From: Marcelo Fabiani [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: Friday, December 22, 2006 6:21 AM Subject: find date an time of a table update Hi, I didn't find

RE: only update if values different

2006-12-11 Thread emierzwa
I agree, you should just update it since the standard operation for MYSQL is to only apply updates if the value is changing. http://dev.mysql.com/doc/refman/5.0/en/update.html If you set a column to the value it currently has, MySQL notices this and does not update it. Ed -Original

only update if values different

2006-12-09 Thread Nick Meyer
What is the best way to UPDATE a row only if values are different? We have a mainframe extract that literally has 100,000 rows and am worried about the performance of just running INSERTs each night. Is there a simple comparison command or would you have to nest a SELECT statement? Thank you

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