How to fetch a record monthly wise
Drop down for month and year and then submit.
<span class="pln">fieldid</span><span class="pun">,</span>
<span class="pln"> name</span>
<span class="pun">,</span>
<span class="pln"> time(int)<br></span>
<span class="pun">============================</span><span class="pln"><br></span>
<span class="lit">1</span>
<span class="pln"> test1 </span>
<span class="lit">158565545</span><span class="pln"><br></span><span class="lit">2</span>
<span class="pln"> 开发者_C百科 test2 </span>
<span class="lit">159545222</span><span class="pln"><br></span><span class="lit">3</span>
<span class="pln"> test3 </span>
<span class="lit">159995545</span><span class="pln"><br></span>
fieldid, name, time(INT)
============================
1 test1 158565545
2 test2 152548856
3 test3 159544856
etc....
Show report like: test1 is for current month test2 is for prev. month , etc.
How can I fetch records monthly-wise when I load a page the first time the current month report shows?
select *
from MyTable
where MONTH(FROM_UNIXTIME(time)) = MONTH(NOW())
精彩评论