﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Teradata Forums / Data Warehousing  / Teradata   / Date range / Latest Posts</title><generator>InstantForum.NET v4.1.4</generator><description>Teradata Forums</description><link>http://www.teradata.com/teradataforum/</link><webMaster>info@teradata.com</webMaster><lastBuildDate>Wed, 03 Dec 2008 21:20:27 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Date range</title><link>http://www.teradata.com/teradataforum/Topic9885-1-1.aspx</link><description>I perform a similar query quite often when I want to get data from the first of the month until today's date--and the way I do it is by casting my date column as a date then taking day from current_date-current_date plus one as my first day of the month and then simply current_date for today.  The code example is below:[code]cast(a.snapshot_date as date) BETWEEN (current_date - EXTRACT(DAY FROM current_date)+1) AND current_date; [/code]So I'm sure this could easily be set to pull the previous week's data by just inserting the code you had for a week ago--i.e. ((current_date -7)).</description><pubDate>Fri, 16 May 2008 08:44:31 GMT</pubDate><dc:creator>SpeedsterZ28</dc:creator></item><item><title>RE: Date range</title><link>http://www.teradata.com/teradataforum/Topic9885-1-1.aspx</link><description>works for me.  Are you sure your table has data for the range given?  </description><pubDate>Tue, 04 Mar 2008 09:28:04 GMT</pubDate><dc:creator>jeff_o</dc:creator></item><item><title>RE: Date range</title><link>http://www.teradata.com/teradataforum/Topic9885-1-1.aspx</link><description>I got this from someone in the forum last month as I had the same question....INNER JOIN (Select calendar_date-day_of_week-6 as min_date, calendar_date-day_of_week as max_datefrom sys_calendar.calendar where calendar_date = current_date) date_rangeON trans_date between date_range.min_date and date_range.max_date...</description><pubDate>Mon, 03 Mar 2008 17:20:43 GMT</pubDate><dc:creator>jclasen</dc:creator></item><item><title>RE: Date range</title><link>http://www.teradata.com/teradataforum/Topic9885-1-1.aspx</link><description>Hi Nitin,"it's not working for me" is not helpfull at all, at least provide the error code/message.It's working for me :-)Dieter</description><pubDate>Thu, 29 Nov 2007 01:52:30 GMT</pubDate><dc:creator>dnoeth</dc:creator></item><item><title>RE: Date range</title><link>http://www.teradata.com/teradataforum/Topic9885-1-1.aspx</link><description>select * from sys_calendar.calendar where calendar_date between current_date-7 and current_date order by calendar_dateThe above query does return rows for me. Check the column that you are using in your where condition.</description><pubDate>Wed, 28 Nov 2007 15:15:35 GMT</pubDate><dc:creator>Nithyanand R G</dc:creator></item><item><title>RE: Date range</title><link>http://www.teradata.com/teradataforum/Topic9885-1-1.aspx</link><description>May be the date format or datatype in the column you are comparing to is different. Try casting to same format and data type.  You may also try using &amp;gt;= , &amp;lt;= instead of 'between and'.</description><pubDate>Wed, 28 Nov 2007 11:11:02 GMT</pubDate><dc:creator>Somesh</dc:creator></item><item><title>Date range</title><link>http://www.teradata.com/teradataforum/Topic9885-1-1.aspx</link><description>Hi I want to write a query to get results for only last week, i.e Date between (current_date -7) and current_Date. when i write above syntex it is not working for me. Can anyone help me?Thank in advance.-Nitin</description><pubDate>Wed, 28 Nov 2007 10:24:08 GMT</pubDate><dc:creator>nitinajmeri</dc:creator></item></channel></rss>