Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > MySQL
|
MySQL General discussion about the MySQL database.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the MySQL section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 21st, 2003, 02:56 PM
Registered User
 
Join Date: Jul 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Update Table

I am trying to update a table with a column from a different table. The code I am trying is:

UPDATE table1, table2
SET table1.column = table2.column
WHERE table1.id = table2.id

It works updating the table but it is locking both tables while it runs. I need to find a way to update a table without locking both tables


Thanks

Henry
 
Old December 29th, 2006, 06:57 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 479
Thanks: 0
Thanked 3 Times in 3 Posts
Send a message via MSN to surendran Send a message via Yahoo to surendran
Default

hi,
try with this
update TableOne
    inner join TableTwo on TableOne.commonID = TableTwo.commonID
    set TableOne.field1 = TableTwo.fieldX

surendran
(Anything is Possible)
http://ssuren.spaces.msn.com
 
Old January 20th, 2007, 02:55 AM
Registered User
 
Join Date: Nov 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to vickr1z
Default

Is it possible to add a prefixes zeros on a auto_increment field without adding new field. If ever how could I attain this goal?

More Power!
 
Old January 22nd, 2007, 12:40 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 479
Thanks: 0
Thanked 3 Times in 3 Posts
Send a message via MSN to surendran Send a message via Yahoo to surendran
Default

hi vickr1z,
already i post answer for this question
CREATE TABLE `tblname` (
          `fieldname` int(3) unsigned zerofill NOT NULL auto_increment,
          PRIMARY KEY (`fieldname`)
        )

surendran
(Anything is Possible)
http://ssuren.spaces.msn.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
update table from another db table timbal25 SQL Server 2005 3 January 19th, 2008 06:47 AM
Update one table to another table using DTS in SQL Printmaker SQL Language 0 July 24th, 2007 07:17 AM
How to Update one table with other table data? ramk_1978 SQL Language 2 May 26th, 2006 12:51 AM
update table with an ID Num from different table scoobie PHP How-To 12 January 25th, 2005 12:28 PM
Update parent table with the sum of child table gbrown SQL Language 2 November 9th, 2004 07:53 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.