在MYsql下 
select qq.player_id,sum_cz,pz,position,gem1,gem2,magic3,reduce_dmg,monopoly 
from 
(SELECT  b.player_id,right(type,1) as pz,position,gem1,gem2,magic3,reduce_dmg,monopoly  
 from cq_user a INNER JOIN cq_item b
 on a.id=b.player_id  and  a.`level`>=120 and a.last_login>=20120301 and position>0 and position<19
) qq
LEFT JOIN
(select id_target,sum(case when number=120 then 1.9 when number=530 then 7.99 when number= 1075 then 15.99 when number=60 then 0.99 when number=125 then 1.99 when number=320 then 4.99 else 29.99 end ) as sum_cz 
from e_money  where time_stamp>=1203010000 and type in (6,8) and id_source>10000
group by id_target
) pp
on pp.id_target=qq.player_id 
group by qq.player_id,sum_cz,pz,position,gem1,gem2,magic3,reduce_dmg,monopoly提示出错:SELECT  b.player_id,right(type,1) as pz,position,gem1,gem2,magic3,reduce_dmg,monopoly   这边有错 ?? 求教一下

解决方案 »

  1.   

    建议复制出完整的错误提示信息以供分析。另外 建议你可以分开检查,比如先检查一下 
    (SELECT  b.player_id,right(type,1) as pz,position,gem1,gem2,magic3,reduce_dmg,monopoly 
      from cq_user a INNER JOIN cq_item b
      on a.id=b.player_id  and  a.`level`>=120 and a.last_login>=20120301 and position>0 and position<19
    ) qq
    中的select 部分是否正确。
      

  2.   

    [Err] 1064 - You have an error in your SQL syntax near 'SELECT  b.player_id,right(type,1) as pz,position,gem1,gem2,magic3,reduce_dmg,mon' at line 3上面是出错提示 单个语句都没有问题