Yes, you can combine the functions, but you can use the -1 you have without errors. For example, this works:
SELECT FullName, {fn SUBSTRING("FullName",1,{fn LOCATE(',', "FullName")})} AS "Name" FROM Customer
However using -1 will display a "[QODBC] Invalid argument to scalar functions: SUBSTRING " error first:
SELECT FullName, {fn SUBSTRING("FullName",1, ({fn LOCATE(',', "FullName")} -1) )} AS "Name" FROM Customer
because there's bound to be customers without a "," (comma) in their full name. Using a where clause to first check this, fixes the issue:
SELECT FullName, {fn SUBSTRING("FullName",1, ({fn LOCATE(',', "FullName")} -1) )} AS "Name" FROM Customer Where {fn LOCATE(',', "FullName")} >0
|