Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2003
    Posts
    7

    Unanswered: set Column value with select statement

    Is there a way to set the value for a particula column data using only SELECT statement?

    ex.
    update TABLE set COLUMN = value where COULMNX = value ;

    instead of this, I need to use only a SELECT statement to do the same function.

  2. #2
    Join Date
    Oct 2003
    Location
    Denver, Colorado
    Posts
    137

    Re: set Column value with select statement

    Use REPLACE, the trick is that you must have a primary key or a unique index on the table. This command will replace rows with the same unique index or insert the row like normal. You can use it just like an INSERT.

    Originally posted by bobwilli
    Is there a way to set the value for a particula column data using only SELECT statement?

    ex.
    update TABLE set COLUMN = value where COULMNX = value ;

    instead of this, I need to use only a SELECT statement to do the same function.

  3. #3
    Join Date
    Oct 2003
    Posts
    63

    Re: set Column value with select statement

    Originally posted by aus
    Use REPLACE, the trick is that you must have a primary key or a unique index on the table. This command will replace rows with the same unique index or insert the row like normal. You can use it just like an INSERT.
    Oh, that's great, I didn't kow about this function .

Posting Permissions

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