Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 2005
    Posts
    19
    Provided Answers: 1

    Question Answered: How do I return results in YTD in DB2

    I have the following data I need to return in YTD fashion

    How do i get YTD results from where clause?

    Row PERIODNAME PERIOD_STARTDATE PAYEE NUMOFTOTALCLIENTS AMOUNTPAID_PRODUCER GROSSCOMMISSION SORT_YEAR SORT_MONTH
    1 April 2015 4/1/2015 12:00:00 AM Ben Clarke 0 0 0 2015 4
    2 August 2015 8/1/2015 12:00:00 AM Ben Clarke 99 307434.6 10351.21 2015 8
    3 December 2015 12/1/2015 12:00:00 AM Ben Clarke 0 0 0 2015 12
    4 February 2015 2/1/2015 12:00:00 AM Ben Clarke 0 0 0 2015 2
    5 January 2015 1/1/2015 12:00:00 AM Ben Clarke 0 0 0 2015 1
    6 July 2015 7/1/2015 12:00:00 AM Ben Clarke 83 241554.89999999964 9700.809999999998 2015 7
    7 June 2015 6/1/2015 12:00:00 AM Ben Clarke 72 176667.30000000022 8066.946999999998 2015 6
    8 March 2015 3/1/2015 12:00:00 AM Ben Clarke 0 0 0 2015 3
    9 May 2015 5/1/2015 12:00:00 AM Ben Clarke 0 0 0 2015 5
    10 November 2015 11/1/2015 12:00:00 AM Ben Clarke 0 0 0 2015 11
    11 October 2015 10/1/2015 12:00:00 AM Ben Clarke 0 0 0 2015 10
    12 September 2015 9/1/2015 12:00:00 AM Ben Clarke 84 240754.92000000025 9553.749999999998 2015 9
    Last edited by jazlady; 11-04-15 at 10:41.

  2. Best Answer
    Posted by jazlady

    "Never mind i got it myself.

    You only needed to know that it was DB2 LUW platform and it is datetime.



    Quote Originally Posted by przytula_guy View Post
    so did you trie ? and the error ?
    db2level ? platform ?
    there is no datatype datetime only date - time or timestamp
    "


  3. #2
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    is the column datatype date ?
    maybe char(dateinput,iso)
    look in infocenter at char function and see all possible formats
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

  4. #3
    Join Date
    Sep 2005
    Posts
    19
    Provided Answers: 1
    The period_startdate field is datetime

  5. #4
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    so did you trie ? and the error ?
    db2level ? platform ?
    there is no datatype datetime only date - time or timestamp
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

  6. #5
    Join Date
    Sep 2005
    Posts
    19
    Provided Answers: 1
    Never mind i got it myself.

    You only needed to know that it was DB2 LUW platform and it is datetime.



    Quote Originally Posted by przytula_guy View Post
    so did you trie ? and the error ?
    db2level ? platform ?
    there is no datatype datetime only date - time or timestamp

  7. #6
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    I always had in mind that ladies (jazlady) are more polite than men..
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.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
  •