Omega
Omega

Reputation: 133

how to extract all details from a table using year in where clause

I am new in Mysql. I just want to extract all data in my employee data using year in where class. I have only date column in my table and i want to execute a query using year to extract all data from from my table employee.

example: 2012-02-01 is date value in my column name date.

select * from emp where ??.

Upvotes: 0

Views: 81

Answers (3)

Deepak Bhatia
Deepak Bhatia

Reputation: 6276

Easy and straight forward,

Select * FROM EMPLOYEETABLE WHERE YEAR(DateOfEmployeeColumn) = YourSuppliedYear

Upvotes: 2

Arjun
Arjun

Reputation: 97

WHERE YEAR(date) = 2008 Should work!

Upvotes: 0

prattom
prattom

Reputation: 1743

select * from emp where YEAR(date_column)

Upvotes: 0

Related Questions