I am trying to get a recordset to select all the dates in a list from a certain year (2010 or 2011). I think I am close but I can’t quite get it to work. Can anyone pointout where I am going wrong?
“SELECT FROM dates WHERE coursecode LIKE ‘MQA03’ AND start_date <‘2010-12-25’ ORDER BY start_date”;
If in the WHERE conditions you say that start date has to be at least January 1st and at most Dicember 31th 2010, then there’s no way that query will give you start dates in 2011.
Post the query (with the two conditions I posted) you’re using again please
Thanks I Did that.Very useful.
I’m ashamed to say I never knew you could test queries that way.
So now I have this code:
SELECT * FROM dates WHERE coursecode LIKE ‘MQA03’ AND start_date >= ‘2010-01-01’
AND start_date <= ‘2010-12-31’
I get results (only 2010) which is great but I seem to have more than I need. Which suggests that this part 'LIKE ‘MQA03’ is getting mixed up somewhere.
First of all, if you don’t use wild cards (%), LIKE is useless. You can use
WHERE coursecode = 'MQA03'
And if you could give some example data, of what there is in table, what you want to extract, and what you’re getting, it might help to get clear what the problem is