ALLTRIM( ) in SQL statement
- From: "David" <David.Aman@xxxxxxxxx>
- Date: 11 Mar 2007 19:35:18 -0700
Given the following table:
CREATE TABLE mytable (subject C(10), unit C(10))
INSERT INTO mytable (subject, unit) VALUES ('algebra1',' ')
INSERT INTO mytable (subject, unit) VALUES ('algebra1','1')
INSERT INTO mytable (subject, unit) VALUES ('algebra1','10')
I tried the following SQL statement:
SELECT subject, unit, COUNT(unit) as unitcount ;
FROM mytable ;
WHERE INLIST(unit,'10') ;
GROUP BY subject, unit
The results told me correctly that there was 1 value of '10' in the
table.
===================
Question: Why does the same SQL statement with an added ALLTRIM in
the
WHERE clause result in a response consisting of 3 rows?
SELECT subject, unit, COUNT(unit) as unitcount ;
FROM mytable ;
WHERE INLIST(ALLTRIM(unit),'10') ;
GROUP BY subject, unit
Thanks,
David
.
- Follow-Ups:
- Re: ALLTRIM( ) in SQL statement
- From: Man-wai Chang
- Re: ALLTRIM( ) in SQL statement
- From: Gene Wirchenko
- Re: ALLTRIM( ) in SQL statement
- Prev by Date: Re: SQL into Excel -- Character vs. Numeric fields
- Next by Date: Re: ALLTRIM( ) in SQL statement
- Previous by thread: Record deletions
- Next by thread: Re: ALLTRIM( ) in SQL statement
- Index(es):
Relevant Pages
|
Loading