473,379 Members | 1,174 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

SQL - work around

Expand|Select|Wrap|Line Numbers
  1. UPDATE users set user_type='CLIENT' where user_id in (SELECT user_id FROM clients)
The above query is not working with MYSQL version 4.xx, is there a work around for this.
Nov 25 '08 #1
5 1503
Atli
5,058 Expert 4TB
You could try an INNER JOIN.

Like:
Expand|Select|Wrap|Line Numbers
  1. UPDATE userTable AS u
  2. INNER JOIN clientTable AS c
  3.     ON u.ID = c.ID
  4. SET u.UserType = 'Client';
  5.  
Nov 26 '08 #2
Thank you Atli. But it also gives
Error:
#1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Nov 26 '08 #3
mwasif
802 Expert 512MB
Try this one

Expand|Select|Wrap|Line Numbers
  1. UPDATE users, clients SET users.user_type='CLIENT' 
  2. WHERE users.user_id = clients.user_id
Nov 26 '08 #4
Atli
5,058 Expert 4TB
@samatair
Weird. It worked for me.
I didn't use the same names as you did tho, so make sure you didn't accidentally mess up the syntax when you edited it. (Assuming you did actually edit it?)

The query mwasif posted should work to tho, and he uses that same names you did.
Try that and see what happens.
Nov 26 '08 #5
Great! mwasif's query worked fine. Thank you very much.
Thank you too Atli for the follow up and suggestions.
You both were so helpful.

Thanks once again!
Nov 27 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

18
by: Stephen Waits | last post by:
Occasionally we want to perform a Sqrt where we don't need accuracy and/or we have a good initial guess - a situation where an N-step Sqrt series may be more optimal than a full on Sqrt(). For...
0
by: Daniel | last post by:
Is this a bug in .net file io? is there a work around? when writing a large file with using(StreamWriter ... if the network drive of the share is removed then the file is never closed. I tried...
14
by: Steve Jorgensen | last post by:
Recently, I tried and did a poor job explaining an idea I've had for handling a particular case of implementation inheritance that would be easy and obvious in a fully OOP language, but is not at...
7
by: Pixar Film Rock | last post by:
I'm a newbie, bear with me here. It has one .exe file, is this where all the instruction is stored? Everything else is just data like textures, maps, etc? How do these crackers hack the .exe so...
4
by: Samuel R. Neff | last post by:
I'm using this class to work around the ListView.Cursor bug in .NET 1.0/1.1. It fixes the bug as long as the user mouses around the client area of the listview but if the listview is in detail...
15
by: Brett | last post by:
I'd like to know what management and the work environment are like where you work. I need something relative to compare my current work environment. Here's a few questions I have: 1.) Is it...
3
by: g18c | last post by:
Hi, i am having lots of fun with templates :( The following code is causing me a real headache: #include <vector> using namespace std; class Writer { public: template<typename T> void...
8
by: Lykins | last post by:
We currently use Access 2003 in our company and have had this issues from every version from Access 97 to 2003. We deal with large databases and run a lot of queries over tables with millions of...
48
by: Nathan Sokalski | last post by:
Ever since I found out that they didn't give us a way to install both IE6 and IE7 on the same machine, I have been more frustrated and annoyed with Microsoft than I ever have been with any company...
0
by: kirby.urner | last post by:
This archival (yet recent) posting to an obscure physics list might be of some interest to those taking a longer view. The work/study projects described below come from an Oregon think tank...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.