이번달 게시물에서 베스트 글 한개를 뽑고 싶어요..
본문
$que = $mysqli->query('SELECT * FROM g5_write_free WHERE wr_file = 1 ORDER BY wr_good DESC LIMIT 1');
여기에다가 wr_datetime 을 넣으면 될것 같은데.. 어떻게 해야할까요?
답변 3
wr_good ,wr_comment 는 필요 없으시면 제외 하시면 됩니다
select wr_id , ( (wr_hit*1) + (wr_good*3) + (wr_comment*2) ) as best
from g5_write_free
where wr_is_comment=0
AND wr_datetime > DATE_ADD(NOW(),INTERVAL -1 MONTH )
order by best desc
limit 1;
아래 부분 추가해보세요..
$datetime = date('Y-m');
~ WHERE wr_file = 1 and wr_datetime like '$datetime%' ~
$que = $mysqli->query('SELECT * FROM g5_write_free WHERE wr_file = 1 AND wr_datetime >= '2018-11-01' and wr_datetime <= '2018-11-31' ORDER BY wr_good DESC LIMIT 1');
답변을 작성하시기 전에 로그인 해주세요.