sql多表联合查询
菜鸟跪求大神指导:怎样用sql语句实现将下面的10个表联合查询?我有10个表aut_user_recharge_record_1,aut_user_recharge_re...
菜鸟跪求大神指导:怎样用sql语句实现将下面的10个表联合查询?
我有10个表aut_user_recharge_record_1,aut_user_recharge_record_2 ........字段一样,如图
查寻出来如下效果 展开
我有10个表aut_user_recharge_record_1,aut_user_recharge_record_2 ........字段一样,如图
查寻出来如下效果 展开
2个回答
展开全部
select datanum,pay_type,datatime
from (select * from aut_user_recharge_record_1
union all select * from aut_user_recharge_record_2
union all select * from aut_user_recharge_record_3
union all select * from aut_user_recharge_record_4
union all select * from aut_user_recharge_record_5
union all select * from aut_user_recharge_record_6
union all select * from aut_user_recharge_record_7
union all select * from aut_user_recharge_record_8
union all select * from aut_user_recharge_record_9
union all select * from aut_user_recharge_record_10)
from (select * from aut_user_recharge_record_1
union all select * from aut_user_recharge_record_2
union all select * from aut_user_recharge_record_3
union all select * from aut_user_recharge_record_4
union all select * from aut_user_recharge_record_5
union all select * from aut_user_recharge_record_6
union all select * from aut_user_recharge_record_7
union all select * from aut_user_recharge_record_8
union all select * from aut_user_recharge_record_9
union all select * from aut_user_recharge_record_10)
更多追问追答
追问
create_time是时间戳 还报( # 1248 -每一个派生表必须有它自己的别名)错
追答
那你的日期值是从哪来的?
select datanum,pay_type,datatime
from (select * from aut_user_recharge_record_1
union all select * from aut_user_recharge_record_2
union all select * from aut_user_recharge_record_3
union all select * from aut_user_recharge_record_4
union all select * from aut_user_recharge_record_5
union all select * from aut_user_recharge_record_6
union all select * from aut_user_recharge_record_7
union all select * from aut_user_recharge_record_8
union all select * from aut_user_recharge_record_9
union all select * from aut_user_recharge_record_10) A
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询