I have form with 4 fields namely(start month, start year, end month, end year)
and MySQL table structure is like id, customer id, amount, month, year
Now, I need to display the rows with matching condition as between the start month and year and end month and year.
I tried this query
select id,customer id,concat(month,'-',year) as d1 from payroll where
empid='$_POST[emp_id]' and (STR_TO_DATE(d1,'%m-%Y') between
STR_TO_DATE('$_POST[fmonth]-$_POST[fyear]','%m-%Y') and
STR_TO_DATE('$_POST[tmonth]-$_POST[tyear]','%m-%Y'))
Please advise....
No comments:
Post a Comment