作者gargamel (Nerding)
看板Database
标题Re: [SQL ] 请问从五个资料表内抓最新的五笔SQL怎麽下
时间Sat Nov 3 13:35:05 2007
抄的...XD
select * from (
(select * from boards
where board_name = '1'
order by posttime limit 5) union
(select * from boards
where board_name = '2'
order by posttime limit 5) union
(select * from boards
where board_name = '3'
order by posttime limit 5) union
(select * from boards
where board_name = '4'
order by posttime limit 5) union
(select * from boards
where board_name = '5'
order by posttime limit 5))
order by posttime limit 5;
这样?
※ 引述《pakker (找寻蔚蓝天空)》之铭言:
: select * from (
: (select * from board1 order by posttime limit 5) union
: (select * from board2 order by posttime limit 5) union
: (select * from board3 order by posttime limit 5) union
: (select * from board4 order by posttime limit 5) union
: (select * from board5 order by posttime limit 5) union
: ) AS U order by posttime limit 5;
: 这样?
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 59.36.135.64