Problem with count(*) in mybatis

1,738 views
Skip to first unread message

geetha

unread,
Feb 3, 2012, 2:39:21 AM2/3/12
to mybatis-user
i'm facing problem with count(*) in mybatis ... it is always returning
0...

<select id="checkGeoAreaStatusIsInActive" resultType="int"
parameterType="int">
select count(geo_area_id) from GEO_AREA
where status != 'inactive' and geo_area_id = #{value,
jdbcType=INTEGER}
</select>

i have tried to change the query as below but still facing issues.

<select id="checkGeoAreaStatusIsInActive" resultType="int"
parameterType="int">
select count(*) geo_area_id from GEO_AREA
where status != 'inactive' and geo_area_id = #{value,
jdbcType=INTEGER}
</select>

Larry Meadors

unread,
Feb 4, 2012, 11:21:32 AM2/4/12
to mybati...@googlegroups.com
Try this instead:

select count(*) as value from ...

Larry

c c

unread,
Feb 4, 2012, 8:54:51 PM2/4/12
to mybati...@googlegroups.com

first you must know if it has data in you table ?

 1,you can print the sql
2, excute the sql use some db tools ,




2012/2/3 geetha <mahi.co...@gmail.com>
Reply all
Reply to author
Forward
0 new messages