MySQL Update question

Posted on 2011-09-10
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.
Question by:phat_code
LVL 30

Expert Comment

ID: 36517261
What warnings are you getting?

Is the value 1 or '1'?
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).

Author Comment

ID: 36517347
its number 1

Accepted Solution

phat_code earned 0 total points
ID: 36517369
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.
Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.


Author Closing Comment

ID: 36541472
Found the Answer.
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.

Author Comment

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?

Author Comment

ID: 36518860
I am using PHP MyADMIN maybe thats the problem???????????????
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

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

APEX (Application Express) is used to develop a web application from Oracle. SQL Workshop is one of the tools that comes with Oracle APEX to query or modify the database objects or to make any changes to the structure.
CCModeler offers a way to enter basic information like entities, attributes and relationships and export them as yEd or erviz diagram. It also can import existing Access or SQL Server tables with relationships.
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…

895 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