Anyone good with MySQL Queries?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tiger
    Confirmed User
    • Apr 2002
    • 6986

    #1

    Anyone good with MySQL Queries?

    I'm trying to write a query and I'm having some problems getting it to do what I want.

    I want to compare columnA.commenter_id to all the values in columnB.user_id
    if there is no columnA.commenter_id that corresponds to a columnB.user_id
    then set columnA.commenter_id to = 999999.

    Thanks in advance.

  • psili
    Confirmed User
    • Apr 2003
    • 5526

    #2
    UPDATE TABLE_1 LEFT JOIN TABLE_2 ON TABLE_1.COLUMN_1= TABLE_2.COLUMN_2
    SET TABLE_1.COLUMN = EXPR WHERE TABLE_2.COLUMN2 IS NULL

    Sorry. Just lazy and posting from MySQL docs.
    Your post count means nothing.

    Comment

    • tiger
      Confirmed User
      • Apr 2002
      • 6986

      #3
      Originally posted by psili
      UPDATE TABLE_1 LEFT JOIN TABLE_2 ON TABLE_1.COLUMN_1= TABLE_2.COLUMN_2
      SET TABLE_1.COLUMN = EXPR WHERE TABLE_2.COLUMN2 IS NULL

      Sorry. Just lazy and posting from MySQL docs.
      THANK YOU SO MUCH!

      I suck at mysql this was taking me forever. I know a few guys that know way more then me and they couldn't do it either.

      Big thanks!

      Comment

      • fatfoo
        ICQ:649699063
        • Mar 2003
        • 27763

        #4
        So you got the answer? Bump if more answers needed.
        Send me an email: [email protected]

        Comment

        Working...