Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2004

    Unanswered: column chechking while updating

    If amc.amc2>0 then
    “UPDATE amc set AMC2= AMC2 + “ & val(txtamt.text) & “where am1=1”
    else if amc.amc2<0 then
    “UPDATE amc set AMC2= “ & val(txtamt.text) & “where am1=1”
    end if

    Here I check the value of column with if condition statement. I need to check the column with out if condition statement.

    What is my doubt is that how I can check value of amc2 column while updating.

    eg: update amc set case when amc2>0 then AMC2= AMC2 + “ & val(txtamt.text)
    like this

    Is it possible with “case-when -end”?

    If it is possible I can solve a big problem in my project.
    Can you give me an example with this query?

  2. #2
    Join Date
    Sep 2003
    The extremely Royal borough of Kensington, London
    update amc
    set amc2 = “ & val(txtamt.text) & “ + (CASE WHEN amc2 >= 0 THEN amc2 ELSE 0 END)
    where am1=1;
    Last edited by r123456; 01-03-04 at 13:39.
    Bessie Braddock: Winston, you are drunk!
    Churchill: And Madam, you are ugly. And tomorrow, I'll be sober, and you will still be ugly.

Posting Permissions

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