How do you select a datetime column by month?
TABLE A
TITLE MY_DATETIME
blah 2011-03-26 05:44:43.213
SELECT *
FROM TABLE A
WHERE MY_DATETIME = "August"
I use EXTRACT
function instead of DATEPART
.
DATEPART
function doesn't exist in my mysql.
SELECT *
FROM TABLE A
WHERE DATEPART(month, MY_DATETIME) = 8
Or, less reliably based on language setting:
...
WHERE DATENAME(month, MY_DATETIME) = 'August'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With