两个表之间的排序问题

luoruigg 2005-09-15 06:31:20

id typeid name dateandtime

1 3 4 5
2 6 7 8



tab2表
typeid typename dateandtime
3 2 12
6 2 14



tab1的typeid与tab2的typeid是链接关系

查询出tab1中所有的记录并根据tab1中的typeid查询出tab2的所有记录
根据tab2的typeid进行排序然后再根据tab1的dateandtime进行排序
...全文
64 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
yjbnew 2005-09-15
  • 打赏
  • 举报
回复
select a.id,a.typeid,a.name,a.dateandtime,b.typeid,b.typename,b.dateandtimefrom tab1 a,(select * from tb2 where typeid in (select typeid from tb1 ) order by typeid) b order by a.dateandtime
shine2000 2005-09-15
  • 打赏
  • 举报
回复
select t1.id, t1.typeid, t1.name, t1.dateandtime, t2.typeid, t2.typename, t2.dateandtime
from tab1 t1, tab2 t2
where t1.typeid = t2.typeid
order by t2.typeid, t1.dateandtime
不知道行不行

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧