holdemfoldem
Programmer
...I'm writing an app in VB 6 connecting to a main frame DB2 data base and wish to order the results of a select statement by two fields, SCHLYEAR and TERM, corresponding to the school year and the term, (ie: Fall, Spring, or Summer).
What keeps me from simply using:
"SELECT FIELD1, FIELD2, ..., FIELDN ORDER BY SCHLYEAR, TERM"
is that the TERM field is not well maintained. It is a 2 byte field which is supposed to have a "1" for Fall, "2" for Spring, or "3" for Summer, which it does. BUT the field may have any of the following values:
"01", " 1", "1 ", similar for "2" and "3".
This results in unreliable sorts because the first byte may be either a "0", " ", or "1, 2, or 3".
I've tried some suggestions by fellow staff, like case statements, etc, but keep getting non-descript SQL errors.
Can anyone help me build a SELECT statement so I can get an order based on the "1", "2", or "3" contained somewhere within each TERM field?
Thanks ahead for any help!
What keeps me from simply using:
"SELECT FIELD1, FIELD2, ..., FIELDN ORDER BY SCHLYEAR, TERM"
is that the TERM field is not well maintained. It is a 2 byte field which is supposed to have a "1" for Fall, "2" for Spring, or "3" for Summer, which it does. BUT the field may have any of the following values:
"01", " 1", "1 ", similar for "2" and "3".
This results in unreliable sorts because the first byte may be either a "0", " ", or "1, 2, or 3".
I've tried some suggestions by fellow staff, like case statements, etc, but keep getting non-descript SQL errors.
Can anyone help me build a SELECT statement so I can get an order based on the "1", "2", or "3" contained somewhere within each TERM field?
Thanks ahead for any help!