+ Reply to Thread
Results 1 to 2 of 2

Thread: UPDATE a record Based on SELECT

  1. #1

    UPDATE a record Based on SELECT

    I want to update records based on certain SELECT value .
    Code:
     UPDATE ShippingCost
    
     SET
    
        IF EastCost>WestCost
    
           Canada= EastCost*1.8
    
        ELSE
    
           Canada= WestCost*1.8
        ENDIF

  2. #2
    Junior Member
    Join Date
    Jan 2012
    Posts
    13
    You need to use Case
    Code:
     UPDATE ShippingCost
    
     SET
         Canada = CASE WHEN EastCost>WestCost THEN  EastCost*1.8
                       ELSE WestCost*1.8 END

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

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