Subject | Re: [firebird-support] 'IN' problem |
---|---|
Author | Svein Erling Tysvaer |
Post date | 2006-10-20T17:43:07Z |
Hi Nick!
'1, 2, 3' in the BASEIDENT field (most likely all records).
numbers 1 or 2 or 3 in the BASEIDENT field.
Say your table contains the following rows:
BASEIDENT
1
2
3
1, 2, 3
If BASEIDENT was a string field, the first two selects would return 3,
the last would probably return 4 (I think there is a difference between
the character '1' and the integer 1. Firebird doesn't automagically turn
one value into three, you have to split them yourself and supply three -
not one - parameters, casting them to the correct type.
HTH,
Set
> SELECT count(*) FROM TBLTXAPPMSGQ WHERE BASEIDENT NOT IN ( '1, 2, 3' )This counts all records that does not contain the 7 characters string
'1, 2, 3' in the BASEIDENT field (most likely all records).
> SELECT count(*) FROM TBLTXAPPMSGQ WHERE BASEIDENT NOT IN ( :str ) into :rcount2;Same as above.
> SELECT count(*) FROM TBLTXAPPMSGQ WHERE BASEIDENT NOT IN ( 1, 2, 3 )Unlike the other two SELECTs, this one exclude all records that have the
numbers 1 or 2 or 3 in the BASEIDENT field.
Say your table contains the following rows:
BASEIDENT
1
2
3
1, 2, 3
If BASEIDENT was a string field, the first two selects would return 3,
the last would probably return 4 (I think there is a difference between
the character '1' and the integer 1. Firebird doesn't automagically turn
one value into three, you have to split them yourself and supply three -
not one - parameters, casting them to the correct type.
HTH,
Set