where 后面跟group by A,B,C

解决方案 »

  1.   


    不行啊。。加了GROUP 后就一直显示 invalid identifier C, 如果我把C删了 就显示 invalid identifier B- -哪里有问题
      

  2.   


    create table TableA
    (
       id int,
       name nvarchar(10),
       phone varchar(20)
       
    )create table TableB
    (
       id int,
       wage int
       
    )
    insert into TableA 
    select 1,'张三','123456789'insert into TableB 
    select 1,1000 union all
    select 1,2000 union all
    select 1,3000 union all
    select 1,4000 union all
    select 1,5000 union all
    select 1,6000 union all
    select 1,7000 union all
    select 1,8000 union all
    select 1,9000 union all
    select 1,10000 union all
    select 1,11000 union all
    select 1,12000 create view A
    AS
    select a.id ,a.name ,a.phone ,AVG (b.wage ) AS wage from TableA a,TableB b where a.id =b.id 
    group by a.id ,a.name ,a.phone
    select * from A