soundarr
New User
Joined: 17 Jan 2008 Posts: 25 Location: Chennai
|
|
|
|
Dear All,
Can you please suggest the easiest way to fetch records from a table with a column (char) having characters other than non-specified values.
For example: I need values which have characters other than A, B and C
i/p :
AC
ABC
ACD
IFB
GABC
o/p:
ACD
IFB
GABC
Thanks for having a look!
Best Regards,
Soundar |
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Sounds like a class project
you only want ROWS (there are no records in db2 tables)
which contain char D thru Z? (don't care about spaces, special char, lower case or numeric)
How large is the Column? (what is the length)
assuming that it is a 4 char column
Code: |
SELECT ?
FROM table
WHERE SUBSTR(column,1,1) > 'D'
OR SUBSTR(column,2,1) > 'D'
OR SUBSTR(column,3,1) > 'D'
OR SUBSTR(column,4,1) > 'D'
|
you could also reverse it and make it
WHERE
SUBSTR(column,1,1) > 'D'
or
SUBSTR(column,1,1) < 'A'
or
... |
|