I'm trying to extract data from a MySQL server with PHP. The information has a date field like this YYYYMM (fx. 201108). My question is how would an SQL query look if I wanted to return the first or last half of a specific year? I have tired something like this, however the lessthan seems to be ignored:
SELECT * FROM `poster` WHERE mdr LIKE '2011%' AND mdr < '%06'
I'm afraid google havnt been much help for me.
<20and11?? and what is thedatatypeof field where u store that date??DATETIMEdata type. Then you can simply use<and>to compare dates.STRINGfunction ondatetimedatatype field