search with specific date sql
I want to data for a specific date in SQL.
This is the structure of my db:
- Column 'date' date format '2011-02-07 09:42:56'
I want to get all rows from column 'user' from month '02' as well as day '07开发者_如何学运维'
select *
from datesTable
where ((DATEPART(mm, date) = 2) and (DATEPART(dd, date) = 7))
SELECT DATEPART(yyyy,clmDate) AS n_Year,
DATEPART(mm,clmDate) AS n_Month,
DATEPART(dd,clmDate) AS n_Day
FROM tblName
WHERE ' write condition'
get Only Month , date and year Details
精彩评论