Henry Olive 5 Posted March 25, 2021 I wish everyone a healthy day. Interbase 2007, SELECT ARD.CODE,ARD.DEBIT,ARD.CREDIT FROM ACCRECDETAIL ARD JOIN ACCRECEIPT AR ON AR.RNO=ARD.RNO WHERE (ARD.CODE >= SUBSTR('180',1,3)) and (ARD.CODE <= SUBSTR('190',1,3)) Above SQL works but i can get Codes between '180' and '189' NOT 190 If i change WHERE CLAUSE like below i can get all records Code between '180' and '190' WHERE (ARD.CODE >= SUBSTR('180',1,3)) and (ARD.CODE <= SUBSTR('191',1,3)) /* I changed 190 to 191 */ What is wrong ? Thank You Share this post Link to post
Guest Posted March 25, 2021 (edited) "1901" <= "190"? It is not. "1801" >= "180"? Yes. WHERE ARD.CODE >= '180' and (SUBSTR(ARD.CODE, 1, 3) <= '190' Aside; SUBSTR('180', 1, 3), besides being useless, is not very readable. HTH Edited March 25, 2021 by Guest Share this post Link to post