Question : Teradata Where Clause - Limit date to this month

I'm using this WHERE clause to display only records entered this month:

where extract(month from report_dt) = extract(month from date)

The problem is that it also returns records entered previous years in June. How could I limit the returned records for this month, this year? I'm new at Teradata, please help.
Thank you very much.

Answer : Teradata Where Clause - Limit date to this month

Hi,

try

where extract(month from report_dt) = extract(month from date) and extract(year from report_dt) = extract(year from date)

if you get performance problems with this clause change it to an interval clause (with start and end date) , this may be optimized better

where start_dt <= report_dt and report_dt <= end_dt
Random Solutions  
 
programming4us programming4us