mysql 做的demo

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)
)

posted on 2012-07-25 11:10  猎-户-座  阅读(360)  评论(0编辑  收藏  举报

导航