有这么一个sql
select count(*) from (
select f.shop_id as shopId
,s.shop_name as shopName
,s.shop_logo as src
,s.[user_id] as userId
,u.user_names as userName
,s.shop_time as shopTime
,c.category_name as categoryName
,p.sale_honour as honour
,s.sale_counts as saleCounts
,a.favorCounts
,f.[type]
from
t_sns_favor as f
,t_sns_user as u
,t_sns_shop as s
,t_sns_user_points as p
,t_sns_category as c
,(select count(*) as favorCounts,shop_id as id
from t_sns_favor where [user_id]=0 group by shop_id ) a
where
f.shop_id=s.shop_id
and s.[user_id]=u.[user_id]
and s.sale_type=c.category_id
and u.[user_id]=p.[user_id]
and a.id=f.shop_id
and f.[user_id]=0
) as a
在sql2005测试过sql 没有问题 可以执行
但是在代码里面一运行就出现下面错误
com.microsoft.sqlserver.jdbc.SQLServerException: 关键字 'where' 附近有语法错误
在程序中打印出来的sql也同样能在sql2005中执行 这是为什么??请高手指点