Possible Duplicate:
mysql_fetch_array() expects parameter 1 to be resource, boolean given in select
In MySQL I am trying to select only the distinct years from over a thousand rows using a textual field called 'edate' that is formatted "1-Jan-2010":
SELECT DISTINCT DATE_FORMAT(STR_TO_DATE(edate, '%e-%b-%Y'), %Y)
FROM addnews
WHERE status = 1
AND archives = 1
AND delete1 = 0
MySQL returns
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\WAMP\www\baycrossings\web\archives.php on line 28"
In MS SQL this works as follows:
select distinct(year(edate))
from addnews
where status = 1
and archives = 1
and delete1 = 0
Does MySQL not allow substring selection? I am trying to avoid selecting hundreds of times more data than I need per query.