Reputation: 1
I have a database table field named User_Created_Date of type Varchar.I want to write a query to fetch all records where the difference between Today's date and User_Created_Date is greater than 31 days
pls help
Upvotes: 0
Views: 93
Reputation: 262939
Since your VARCHAR
column's date format is DD/MM/YY
, use:
select * from Your_Table
where DATEDIFF(day, CONVERT(datetime, User_Created_Date, 3), GETDATE()) > 31;
Upvotes: 1