Solved

MySQL Update question

Posted on 2011-09-10
9
315 Views
Last Modified: 2012-05-12
UPDATE `URL` SET `Column`=1 WHERE `Top Level Category`='Cat1'
AND  `Page Category`='Cat2' AND  `Group Category`='Cat3'

Open in new window

Can you fix this MySQL statement? I need it to work in PHPMyAdmin.
0
Comment
Question by:phat_code
9 Comments
 
LVL 30

Expert Comment

by:hnasr
ID: 36517261
What warnings are you getting?

Is the value 1 or '1'?
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 36517277
There nothing wrong with your SQL unless it doesn't match your table.  @hnasr is asking whether it should be the number 1 (without quotes) or the character '1' (with quotes).
0
 

Author Comment

by:phat_code
ID: 36517347
its number 1
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Accepted Solution

by:
phat_code earned 0 total points
ID: 36517369
UPDATE  `URL`
SET `Column`=1 
WHERE  `Top Level Category` LIKE  'cat1'
AND  `Page Category` LIKE  'cat2'
AND  `Group Category` LIKE  'cat3'

Open in new window

Fixed it.
0
 

Author Closing Comment

by:phat_code
ID: 36541472
Found the Answer.
0
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 36517613
@phat_code: that doesn't make much sense as LIKE 'literal w/o wildcard' acts the same as = 'literal w/o wildcard'; therefore, it must be something with data types of the fields maybe? Not disputing the closure or that you solved this by the way. I am happy you figured it out. My concern is if you are going to leave this in the PAQ, it would be great for future readers to truly understand the solution, i.e., if using TEXT columns use ... or something to that effect.
0
 

Author Comment

by:phat_code
ID: 36518851
Not sure what you mean Text columns? And who do I give the points too also why didn't it work with equal signs?
0
 

Author Comment

by:phat_code
ID: 36518860
I am using PHP MyADMIN maybe thats the problem???????????????
0
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 36519131
You give the points to your own comment as you did to answer the "who do I gives to" question. What I meant by TEXT columns is what is the data type of the columns `Top Level Category`, `Page Category`, `Group Category`. It may have to do with their type. I threw out TEXT as an example. If you don't know, then that is fine. I was just making the point that "why didn't it work with equal signs?" isn't clear from the information in the question. Not an issue for you really, so again no worries if you don't know.

Regards, Kevin
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

786 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