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? Quote 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%' Quote Link to comment https://forums.phpfreaks.com/topic/110316-wildcards/#findComment-566134 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.