Using MySQL & SQL Server
ID sDate
001 03/06/2010
002 07/08/2010
....
....
sDate Datatype is varchar
Format mm/dd/yyyy
I want to take the date count means How many days is still there, It should compare the system date…
How to convert my varchar to datetime datatype, then how to compare the mysdate to system for getting the totalday counts
sDate - SystemDate = Totalday
ExpectedOutput
ID sDate Totaldays
001 03/07/2010 3 days
002 07/07/2010 7 days
.....
How to make a query for this condition. Need query help.
Your question states MySQL & SQL Server so here is both:
SQL Server datediff function:
MySQL datediff function:
This uses the STR_TO_DATE function to convert the varchar to a date and assumes that the format of your date strings is in the format month/day/year.