Consultor Eletrônico



Kbase P114156: How can a query be constructed in SQL-92 that returns only records where a given date field is prior
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   3/10/2006
Status: Unverified

GOAL:

How can a query be constructed in SQL-92 that returns only records where a given date field is prior to January 1st of the current year?

FIX:

The following sample SQL-92 SELECT statement shows how to write a query where a given date field needs to be checked for being three (3) years earlier than January 1st of the current year:

SELECT * FROM PUB.Customer WHERE PUB.Customer.SomeDate < TO_DATE(CONCAT('01/01/',TO_CHAR(YEAR(SYSDATE))))