SQL QUARTER

SQL QUARTER is a MySQL function which also supported by Ingres database. It will return the quarter of a date expression as an integer (in the range of 1-4).

SQL QUARTER Syntax

SELECT QUARTER(date-expression)

SQL QUARTER Example

SELECT QUARTER(NOW()) AS QT

The result will look like: (suppose it’s 2011-11-05 now)

QT
4
SELECT QUARTER('2012-08-03') AS QT

The result will look like:

QT
3

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>