Friends, I'm doing a SQL query where I have to use only part of the characters in one column and compare it with another to get the matches:
SELECT A.NUMCLIEN,A.CODIDENT,A.CLAIDENT,A.DIGIDENT,C.ENTIOFI,C.CUENTA
FROM GPBC.UGDTMAE C JOIN GPBC.PEDT008 B
--C.CUENTA tiene 10 caracteres, necesito tomar los 8 ultimos, el campo B.NUMECTA tiene 8 caracteres, debo seleccionar los registros que coinciden en estos campos.
ON SUBSTRING(C.CUENTA,3,8)=B.NUMECTA
JOIN GPBC.PEDT001 A ON B.NUMCLIEN=A.NUMCLIEN
The error displayed when executing the query:
QUERY MESSAGES: Argument '3' of scalar function 'SUBSTRING' is invalid.
I have already tried without success with different examples and I have searched in different pages how this query could be corrected. Thanks.