Database Welcome to the Teradata Forums. Read the guidelines on posting. Email notifications and RSS feeds are available, and also a chronological list of all forum activity.
 Print All Forums Database praveensc4041 1 post Joined 09/14 03 Sep 2014 Get Order ```ACCT_ID ACCT_NM ORD_NBR ORD_DT ORD_AMT_USD 595709114 ASDASD 44444 7/28/2014 546 2224809440 ASDASD 44444 5/2/2012 546 1724031572 ASDASD 44444 6/22/2011 546 1702887651 ASDASD 44444 7/3/2014 546 1724020508 ASDASD 44444 7/16/2012 546 1148151895 ASDASD 44444 9/18/2013 546 2125154824 ASDASD 44444 9/2/2014 546 1503552723 ASDASD 44444 12/20/2011 546 2224689808 ASDASD 44444 10/4/2010 546 931387698 ASDASD 44444 12/31/2010 546 ```I very new to TD. I need to get order details based on current quarter.Please help me how to work on this. I am providing sample data below   Raja_KT 1246 posts Joined 07/09 03 Sep 2014 Current quarter of previous years too? I am a bit confused :) Hope this calculation for  a quarter example below can help you: select .......... ,((CAST(EXTRACT(MONTH FROM ORD_DT) AS BYTEINT)-1)/3)+1 as QUARTER from your_table where QUARTER=3 Raja K Thaw My wiki: http://en.wikipedia.org/wiki/User:Kt_raj1 Street Children suffer not by their fault. We can help them if we want. VandeBergB 182 posts Joined 09/06 03 Sep 2014 skip the cast, extract etc... select blah, blah, blah, cal.quarter_of_year from yourtable yt inner join sys_calendar.calendar cal on (yt.orddt = cal.calendar_date); the system calendar has quarter of year, quarter of calendar and a multitude of pre-calculated calendar items.   Cheers! Some drink from the fountain of knowledge, others just gargle. Raja_KT 1246 posts Joined 07/09 03 Sep 2014 Yes it can be done in many ways. You can check the explain and see. Raja K Thaw My wiki: http://en.wikipedia.org/wiki/User:Kt_raj1 Street Children suffer not by their fault. We can help them if we want. You must sign in to leave a comment. Active Posters