Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2012
    Posts
    91

    Unanswered: Re: If 'IF EXISTS' does not exist in mysql?

    I trie to execute instruction:
    IF EXISTS (SELECT * FROM Table1 WHERE Column1='SomeValue') UPDATE Table1 SET (...) WHERE Column1='SomeValue'
    and gets an error.

  2. #2
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    Your statement does not make sense. You have the condition to test for the presence of the values already in the where clause.

    Just run:
    Code:
    UPDATE table1 
        SET ...
    WHERE column1 = 'SomeValue';
    The if statement (if it was legal) is totally useless

  3. #3
    Join Date
    Jan 2012
    Posts
    91
    You are right. In the absence of values ​​in the Column1 is no error. Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •