Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2007
    Posts
    6

    Unanswered: "in" problem in DB2

    Thanks Rahul for your previous answer

    SELECT * FROM TFCT_CNTCT where date(TFCT_CNTCT.STRT_DT)
    in
    (
    '01/05/2007', '01/04/2007'
    )
    is getting executed and giving results

    ------------------------------------------------------

    but the following statement is not giving results.

    SELECT * FROM TFCT_CNTCT where date(TFCT_CNTCT.STRT_DT)
    in
    (
    select current date,current date -1 day from sysibm.sysdummy1
    )

    you could send me the answers to mandla.srinivas@gmail.com

  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    Try this:

    SELECT * FROM TFCT_CNTCT where date(TFCT_CNTCT.STRT_DT)
    in
    (
    select current date from sysibm.sysdummy1
    UNION ALL
    select current date -1 day from sysibm.sysdummy1
    )
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  3. #3
    Join Date
    Jan 2007
    Posts
    6

    Thank You

    thank you very much Marcus

  4. #4
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    or
    Code:
    SELECT * FROM TFCT_CNTCT where date(TFCT_CNTCT.STRT_DT)
    in (values current date, current date -1 day)
    ---
    "It does not work" is not a valid problem statement.

  5. #5
    Join Date
    Sep 2004
    Location
    Belgium
    Posts
    1,126
    or even
    Code:
    SELECT *
    FROM   TFCT_CNTCT
    WHERE  date(STRT_DT) in (current date, current date - 1 day)
    --_Peter Vanroose,
    __IBM Certified Database Administrator, DB2 9 for z/OS
    __IBM Certified Application Developer
    __ABIS Training and Consulting
    __http://www.abis.be/

Posting Permissions

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