Results 1 to 2 of 2

Thread: DB2 Query Help

  1. #1
    Join Date
    Jan 2010
    Posts
    1

    Lightbulb Unanswered: DB2 Query Help

    Hi, I am trying to execute the following query in DB2 command editor,

    db2 SELECT B.ACCTNO,B.BNO, B.STATUS, B.ASTATUS, B.VALIDFROM, B.VALIDTO FROM DEB.ACCOUNT B WHERE B.ACCTNO IN (SELECT A.ACCTNO FROM DEB.ACCOUNT A WHERE A.VALIDTO IS NULL AND A.STATUS='0' AND A.ASTATUS='0' GROUP BY A.ACCTNO HAVING COUNT(*) > 1) >> out.txt

    and the following error is printed in the out.txt;

    SQL0104N An unexpected token "<END-OF-STATEMENT>" was found following "". Expected tokens may include: "< > = <> <= !< !> != ^< ^> ^= >= IN NOT". SQLSTATE=42601

    Please help me

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Obviously, single quotation marks and/or asterisk are interpreted by the shell and never make it to the DB2 command line processor. You should enclose the entire SQL statement in double quotation marks.
    ---
    "It does not work" is not a valid problem statement.

Posting Permissions

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