MySQL联表统计查询报错“Every derived table must have its own alias”

MySQL联表统计查询报错 Every derived table must have its own alias

意思就是派生表需要加个别名,参照我的原SQL

select * from
  (select
      count(pid) as msum,
      count(sex = '男' or null ) as mman,
      count(sex = '女' or null ) as mwoman
    from myc_member),
  (select
      count(pid) as psum,
      count(sex = '男' or null ) as pman,
      count(sex = '女' or null ) as pwoman
    from myc_partymember)

这就报错了,给个名字后

select * from
  (select
      count(pid) as msum,
      count(sex = '男' or null ) as mman,
      count(sex = '女' or null ) as mwoman
    from myc_member) as one,
  (select
      count(pid) as psum,
      count(sex = '男' or null ) as pman,
      count(sex = '女' or null ) as pwoman
    from myc_partymember) as tow

OK了…

已标记关键词 清除标记
相关推荐
©️2020 CSDN 皮肤主题: 黑客帝国 设计师:白松林 返回首页