1064 error in mysql query not sure what I am doing incorrect

Discussion in 'MySQL' started by xbat, Oct 7, 2013.

  1. #1
    I am trying to update table1 with the number 2 where item from table2 = mi from table1 AND where 2014 is in the cd

    row from table 2 I am trying to run this in phpmyadmin but I can not figure out what I am doing wrong. I keep getting

    error 1064. Any pointers or help would greatly be appreciated.

    product_to_categories = ptc
    categories_id = ci
    web_index_all_txt=wiat
    manufacturers_id=mi
    CATALOG_DESCRIPTION=cd

    table1=ptc
    ci= column in table1
    mi= column in table1
    table2=wiat
    item= column in table2
    cd= column in table2

    UPDATE ptc SET ci=2 SELECT ITEM FROM wiat WHERE wiat.ITEM=ptc.mi AND
    wiat.cd LIKE '%2014%';
    Code (markup):
     
    Solved! View solution.
    xbat, Oct 7, 2013 IP
  2. #2
    Can you set up an example of the tables and the sql you are using in sqlfiddle.com

    You need to create the tables and give some insert statements and press build schema. Then you can put in your update statements (even though they're not working) and then give us the link.
     
    sarahk, Oct 9, 2013 IP
  3. xbat

    xbat Well-Known Member

    Messages:
    326
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    105
    #3
    actually what I did incorrectly was my order. can you believe that..I just switched a few things around and that turned out to be my issue.
     
    xbat, Oct 9, 2013 IP
  4. sarahk

    sarahk iTamer Staff

    Messages:
    28,830
    Likes Received:
    4,541
    Best Answers:
    123
    Trophy Points:
    665
    #4
    Fantastic!
     
    sarahk, Oct 9, 2013 IP
  5. xbat

    xbat Well-Known Member

    Messages:
    326
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    105
    #5
    yup thank you for the suggestion with sqlfiddle I will have to learn how to use it looks pretty cool.
     
    xbat, Oct 9, 2013 IP