Solved

MySQL Update

Posted on 2013-11-10
2
337 Views
Last Modified: 2013-11-10
I have 2 tables table1 and table2 both with identical columns and data-type

id = int
dob = date

I am trying to update all dob in table 1 based on the id of table 2

I am using the following statement

Update table1
set table1.dob = (select dob from table2
where table1.id = table2.id)
where id = 1;

Open in new window


When i run the query the the ? is displayed but it doesnt seem to procesing the statement, its just hanging. I have set to update one query so it should'nt take that long

any ideas?
0
Comment
Question by:Brogrim
2 Comments
 
LVL 24

Accepted Solution

by:
Tomas Helgi Johannsson earned 500 total points
ID: 39637229
Try this

Update table1
set table1.dob = (select table2.dob from table2
where table1.id = table2.id limit 1)
where table1.id = 1;

Regards,
   Tomas Helgi
0
 

Author Closing Comment

by:Brogrim
ID: 39637394
Thanks
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Foreword In the years since this article was written, numerous hacking attacks have targeted password-protected web sites.  The storage of client passwords has become a subject of much discussion, some of it useful and some of it misguided.  Of cou…
Foreword This is an old article.  Instead of using the MySQL extension that was used in the original code examples, please choose one of the currently supported database extensions instead.  More information is available here: MySQLi / PDO (http://…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now