Get data from Interval of Dates

SELECT * FROM TableName where Date => '2012/10/11'
and Date <= '2012/12/21'

Here we can get datas from StartDate(‘2012/10/11’) to EndDate(‘2012/12/21’)

Advertisements

Select record has highest “Date”(any field)

You can select record corresponding to its highest value in any field

SELECT * FROM tableName where fieldName = (SELECT MAX( fieldName ) FROM tableName)

Here,

SELECT MAX( fieldName ) FROM tableName

Get the Highest in fieldName. It can be number or date(In this “2014-02-30 12:20:12” format).

MAX( fieldName ), does the Magic….;)