select sum(b.ITEM_MONTH_1) from tlk_salary_welfare_budget a ,tlk_salary_welfare_budget_sub b,tlk_reportdetail_first c
where a.id= b.parent
and charindex(a.item_team , CONVERT(VARCHAR(200),c.item_department)) > 0
and CONVERT(VARCHAR(4),a.item_budget_year,120) ='2015'
and c.ITEM_DETAIL_FIRST = '营业成本' and b.item_budget_type = '工资'
这句sql中的charindex(a.item_team , CONVERT(VARCHAR(200),c.item_department)) > 0 ,因为我要查表a的部门在表c的部门中,明明数据库里面是有的,但是加上上诉charindex后,数据库反而查不到了,求解
------解决思路----------------------
VARCHAR 200太短,可能是这个原因