I'd like to do what is written in the subject in a SQLite query.
Does anybody know of a way to do it? I've googled "android how to return a fixed string in a sqlite query" but I can't see any results (not even SO) about that... is it possible nobody's needed this?
other database have a CAST command to get the job done, not sure if SQLite has this.
(especially usefull when concatenating a string with number, not requires for just text)
other database have a CAST command to get the job done, not sure if SQLite has this.
(especially usefull when concatenating a string with number, not requires for just text)
Are you looking for something like this where you assign your expression to a variable and include it in the query:
B4X:
Dim strVar As String="TOTAL"
txt="SELECT '" & strVar & "' AS DeerBear ,SUM(CODE) as SCODE FROM tblChemicals GROUP BY RANK "
Cursor1= SQL1.ExecQuery(txt)
Cursor1.position=8
Log(Cursor1.GetString("DeerBear") & " " & Cursor1.GetString("SCODE"))
And a brief look at Sqlite doc showed a quote(X) function which should return X literal or even coalesce(X,Y,.) function that returns first not null parameter. Hope some of the above may help you.
no, it seems he wants the first field to output 'total'.
it doesn't make much sense actually, if you know that field is always 'Total' I don't see a reason to add it to the restult
as you know the result in advance.
no, it seems he wants the first field to output 'total'.
it doesn't make much sense actually, if you know that field is always 'Total' I don't see a reason to add it to the restult
as you know the result in advance.
It does make sense if you want to take advantage of ExecuteListView and have a 2 lines items where the first line says "Total" and the second shows you that very total