Solved

MySQL Update

Posted on 2013-11-10
2
353 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 25

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

738 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