Get the rows based on the current quarter

  • Hi Guys, Sorry first of all posting the query in wrong, but I hope I will hope some answers. I am working on a report and the data source is Teradata. now I have situation where I want to get order id details based on the current quarter and year I am posting this same data so that it is useful for you guys. For TD related queries I do not where to post. hope fully some of you help me

    ACCT_ID ACCT_NMORD_NBRORD_DT ORD_AMT_USD

    595709114ASDASD444447/28/2014 546

    2224809440ASDASD444445/2/2012 546

    1724031572ASDASD444446/22/2011 546

    1702887651ASDASD444447/3/2014 546

    1724020508ASDASD444447/16/2012 546

    1148151895ASDASD444449/18/2013 546

    2125154824ASDASD444449/2/2014 546

    1503552723ASDASD4444412/20/2011 546

    2224689808ASDASD4444410/4/2010 546

    931387698ASDASD4444412/31/2010 546

  • maybe something along these lines will get you started

    SELECT

    ACCT_ID

    , ORD_DT

    FROM yourtable

    WHERE (DATEPART(q , ORD_DT) = DATEPART(q , GETDATE()))

    AND (DATEPART(year , ORD_DT) = DATEPART(year , GETDATE()));

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • An excellent resource for date-related queries is Roby Page and Phil Factor's Date/Time workbench:

    https://www.simple-talk.com/sql/learn-sql-server/robyn-pages-sql-server-datetime-workbench/

  • guys I searched in Teradata forums I did not get any concrete answers. Any sql pundits can tell me how it can be done

  • Smash125 (9/3/2014)


    guys I searched in Teradata forums I did not get any concrete answers. Any sql pundits can tell me how it can be done

    as I am sure you are aware this is a MS SQL forum not a Teradata forum....so probably the reason why you aint getting much response.

    quick google brought up this

    https://forums.teradata.com/forum/data-modeling/can-teradata-display-the-quarter-value-of-a-date

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply