Como Selecionar os aniversariantes de 1 mês em Paradox ?

Delphi

19/10/2003

Estou c/ um problema ! Como Selecionar todos os Aniversariantes de um determinado mês via componente Query do Delphi, em uma tabela Paradox ?
Não consegui achar nenhuma função em Paradox que consiga quebar a data e retornar somente os aniversariantes do mês passado como parâmetro.
Desde já muito Obrigado Galera !


Cabal

Cabal

Curtidas 0

Respostas

Adilsond

Adilsond

19/10/2003

Local SQL Help

EXTRACT function

Returns one field from a date value.

EXTRACT(extract_field FROM column_reference)

Description

Use EXTRACT to return the year, month, or day field from a DATE or TIMESTAMP column. If the column used with the EXTRACT function contains a NULL value, the return value of EXTRACT will be NULL. If the value is not NULL, EXTRACT returns the value for the specified element in the date, expressed as a SMALLINT.

The Extract_Field parameter may contain any one of the specifiers: YEAR, MONTH, DAY, HOUR, MINUTE, or SECOND. The specifiers YEAR, MONTH, and DAY can only be used with DATE and TIMESTAMP columns. The specifiers HOUR, MINUTE, and SECOND can only be used with TIMESTAMP and TIME columns.

SELECT SaleDate,

EXTRACT(YEAR FROM saledate) AS YY,
EXTRACT(MONTH FROM saledate) AS MM,
EXTRACT(DAY FROM saledate) AS DD

FROM Orders

The statement below uses a DOB column (containing birthdates) to filter to those rows where the date is in the month of May. The month field from the DOB column is retrieved using the EXTRACT function and compared to 5, May being the fifth month.

SELECT DOB, LastName, FirstName

FROM People

WHERE (EXTRACT(MONTH FROM DOB) = 5)

Applicability

EXTRACT operates only on DATE, TIME, and TIMESTAMP values. To use EXTRACT on non-date values, first use the CAST function to convert the column to a date type.

Note:while SQL-92 provides the EXTRACT function specifiers TIMEZONE_HOUR and TIMEZONE_MINUTE, these specifiers are not supported in local SQL.


GOSTEI 0
POSTAR