40esp Posted June 30, 2008 Share Posted June 30, 2008 Right now i hate this sql: SELECT * FROM lookup LEFT JOIN publications ON publications.id = lookup.publication_id WHERE publications.date>='$archive_year%' AND publications.type='News Letter' AND publications.archive='Active' AND lookup.practice_group_id='$practice_id' ORDER BY 'date' DESC in php $archive_year would look like: 2005 for example. And the field publications.date would be something like: 2005-06-06 I think the WHERE publications.date>='$archive_year%' is whats causing my problem. The problem is, it doesn't filter the results right, I want to only display records with the date of 2005, but it gives me 2006, and 2004 records as well. How would I shape up the sql? Quote Link to comment Share on other sites More sharing options...
bluejay002 Posted June 30, 2008 Share Posted June 30, 2008 Talking bout that year thing, yes, there is a work around for that. use, ... WHERE YEAR(publications.date) >= '" . $archive_year . "' ... actually you can also do: ... WHERE YEAR(publications.date) >= '$archive_year' ... but I do not really use such method (personal preference ). Jay, Quote Link to comment 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.