问题
I have the following query that works fine in MS Access, MySQL and SQL Server but when I try to use it in SQLite I get an error:
near "(": syntax error:
I can't find the Left command in any documentation of SQLite so I guess it isn't there but how could I get it to work then.
SELECT
Left(fldcall, 3) AS Group1,
Mid(fldcall, 4, 1) AS Group2,
tblcalls.*,
tblzip.fldcity
FROM
tblcalls
LEFT JOIN
tblzip ON tblcalls.fldzipcode = tblzip.fldzipcode;
回答1:
You can use the substr() function instead:
SELECT substr(fldcall, 1, 3) AS Group1,
substr(fldcall, 4, 1) AS Group2,
tblcalls.*,
tblzip.fldcity
FROM tblcalls
LEFT JOIN tblzip USING (fldzipcode);
来源:https://stackoverflow.com/questions/36370304/replacement-for-left-command-in-sqlite-sql