| 여러 테이블의 최근 게시물 추출 (union all 사용) |
|
|
 |
14년 전 |
qa 라는 테이블과 news 라는 테이블의 최근 날짜별 추출하는 쿼리문입니다.
reg_date 필드에는 날짜가 기록되어있습니다.
$query = "select 'qa' as bbs, code, title, reg_date from qa union all select 'news' as bbs,code, title, reg_date fromnews order byreg_date desc limit 30";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result))
{
echo $row[bbs]." , ".$row[code]." , ".$row[title]." , ".$row[reg_date]."
";
} |
|
추천 : 712 |
추천
목록
|
|