您的当前位置:首页正文

mysql做的demo_MySQL

2020-11-09 来源:我们爱旅游

bitsCN.com

mysql 做的demo

注意事项: mysql union 和 group 碰头 报错 双方要有括号

not in 和 limit 也要分开

(SELECT app_type_id,
app_type_name
FROM `app_dw`.`APP_TYPE` #table_name
order by app_type_id
limit 5)
union all
(select sum(app_type_id) app_type_id,'the_six'
from `app_dw`.`APP_TYPE`
where app_type_key not in ( select * from
(SELECT app_type_key FROM `app_dw`.`APP_TYPE`
order by app_type_id limit 5)as t)
)

bitsCN.com