MySql 联合查询 有三张表A,B,C,三张表有相同的字段,id,title,__typeid,pubdate 三张表都有以上三个字段
答案:2 悬赏:30
解决时间 2021-02-22 02:45
- 提问者网友:℡她的他i☆
- 2021-02-21 20:00
现在要从这三张表中查询出来5条时间最大的信息 就是按照pubdate字段降序(DESC)排列,该怎么写?
最佳答案
- 二级知识专家网友:不服输就别哭
- 2021-02-21 21:35
select top 5 *
from (
select id,title,_typeid,pubdate from A
union all
select id,title,_typeid,pubdate from B
union all
select id,title,_typeid,pubdate from C ) as D order by pubdate desc
from (
select id,title,_typeid,pubdate from A
union all
select id,title,_typeid,pubdate from B
union all
select id,title,_typeid,pubdate from C ) as D order by pubdate desc
全部回答
- 1楼网友:青灯壁纸妹
- 2021-02-21 22:11
你好!
5条时间最大是什么意思 把你的需求说明白一点
如果对你有帮助,望采纳。
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯
• 手机登qq时,显示手机磁盘不足,清理后重新登 |
• 刺客的套装怎么选啊? |