You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by "Charles N. Harvey III" <ch...@alloy.com> on 2004/02/23 23:25:28 UTC
single quotes in query
The only difference in these two queries is the single quote around
the number
in the WHERE clause. The first one returns over 900 results and the
second one
returns only 1. Why such a difference? I clearly want to be using the
second
query, but OJB adds the single quote around WHERE parameters. Should it
be doing
that? Usually it should. Is there any way to turn it off on a
per-query basis?
SELECT COUNT( A0.total_undergrad_enrollment )
FROM UNDERGRAD_PROFILE A0
WHERE ( A0.total_undergrad_enrollment > 1 ) AND
A0.total_undergrad_enrollment < 1000
SELECT COUNT( A0.total_undergrad_enrollment )
FROM UNDERGRAD_PROFILE A0
WHERE ( A0.total_undergrad_enrollment > '1' ) AND
A0.total_undergrad_enrollment < '1000'
Thanks a lot.
Charlie
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: single quotes in query
Posted by "Charles N. Harvey III" <ch...@alloy.com>.
Nevermind. Its because my fields are CHAR and not INTEGER. Can't compare
on a CHAR. So I have to do a CONVERT(int,total_undergrad_enrollment) to get
the right results.
Sorry to bother everyone.
Charlie
Charles N. Harvey III wrote:
> The only difference in these two queries is the single quote around
> the number
> in the WHERE clause. The first one returns over 900 results and the
> second one
> returns only 1. Why such a difference? I clearly want to be using
> the second
> query, but OJB adds the single quote around WHERE parameters. Should
> it be doing
> that? Usually it should. Is there any way to turn it off on a
> per-query basis?
>
>
> SELECT COUNT( A0.total_undergrad_enrollment )
> FROM UNDERGRAD_PROFILE A0
> WHERE ( A0.total_undergrad_enrollment > 1 ) AND
> A0.total_undergrad_enrollment < 1000
>
>
> SELECT COUNT( A0.total_undergrad_enrollment )
> FROM UNDERGRAD_PROFILE A0
> WHERE ( A0.total_undergrad_enrollment > '1' ) AND
> A0.total_undergrad_enrollment < '1000'
>
>
> Thanks a lot.
>
>
> Charlie
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org