40esp Posted June 15, 2008 Share Posted June 15, 2008 I have this statement: SELECT * FROM publications WHERE date='*2008*' ORDER BY 'date' DESC but it returns no records the date field is a text field in mysql, not date/time or date. the string looks like: 2008-06-06 And I want to just filter all records with the year 2008. Why wont this work? Link to comment https://forums.phpfreaks.com/topic/110316-wildcards/ Share on other sites More sharing options...
Barand Posted June 15, 2008 Share Posted June 15, 2008 WHERE YEAR(date) = '2008' The wildcard in MySql, BTW, is "%" and you need to use LIKE with wildcards, not "=". So if your date is held as a string WHERE date LIKE '2008%' Link to comment https://forums.phpfreaks.com/topic/110316-wildcards/#findComment-566134 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.