I want to be able to fetch results from mysql with a statement like this:
SELECT *
FROM table
WHERE amount > 1000
But I want to fetch the result constrained to a certain a month and year (based on input from user)... I was trying like this:
SELECT *
FROM table
WHERE amount > 1000
AND dateStart = MONTH('$m')
...$m
being a month but it gave error.
In that table, it actually have two dates: startDate
and endDate
but I am focusing on startDate
. The input values would be month and year. How do I phrase the SQL statement that gets the results based on that month of that year?