Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2012
    Posts
    1

    Unanswered: Help with update

    I need help with the following.

    update crstrigger set active = 't' where recordid in (select first 1 recordid from crstrigger where triggername = '1134' order by createdatetime desc)

    Getting a syntax error. Sorry for my noobness.

  2. #2
    Join Date
    Jun 2009
    Location
    Lisboa, Portugal
    Posts
    78
    Hi DavinD,

    Try this:

    select first 1 recordid, createdatetime from crstrigger where triggername = '1134' order by createdatetime desc into temp A;

    update crstrigger set active = 't' where recordid in (select recordid from A);


    I hope it works...
    LS

  3. #3
    Join Date
    Sep 2011
    Location
    Pont l'Abbé, Brittany, France
    Posts
    381
    Provided Answers: 1
    Could you please tell WHERE the syntax error is, this would help to understand...

  4. #4
    Join Date
    Jun 2009
    Location
    Lisboa, Portugal
    Posts
    78
    Hi,

    You can't use "first 1" and ordering by a column that you don't select in a "in" clause.
    LS

Posting Permissions

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