Beijing dongcheng district 110000000010
Tianjin 120000000000
.
Table above, only two fields, the number of the top two provinces, in statistical query is how to combine the left function out of the province, the environment for VC,
CodePudding user response:
Doesn't seem to be so smart, I'm afraid can only to get all the data, and then get the top two statistics (not automatic statistics, need to program to calculate), unless you add a field to store provinces, it can automatic statistics by groupingCodePudding user response:
The only resolution, after all, is a string,CodePudding user response:
SQLite left no function, but also left seems SQLite reserved words, because I used sqlite3_create_function create a custom function called left, debugging found sqlite3_create_function function returns 0, creating a success, but I can't call:Select the left (Name, 3) the from exam_tbl where id=1;
Time to perform the above SQL statement will return near "(" : syntax error error, and if I change a name, lefta can, for example,
SQLite, by the way, there is a the substr function, can be used instead of the left:
Select substr (Name, 1, 3) the from exam_tbl where id=1
CodePudding user response:
The substr function, can be used instead of the left