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) www.2cto.com
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)
)
作者 獵-戶-座