Hi,
I need to extract the most recent record of a certain Id, is this way correct or there is a more quick and elegant way using the Max function ?
B4X:
Dim Cursor1 As Cursor
Dim query As String="SELECT * FROM records WHERE ID = John ORDER BY InsDate DESC LIMIT 1"
Cursor1 = MySub.SQL_Bls1.ExecQuery(query)
Cursor1.Position=0
Log(Cursor1.GetString("InsDate") & " - " & Cursor1.GetInt("Size"))
Hi,
I need to extract the most recent record of a certain Id, is this way correct or there is a more quick and elegant way using the Max function ?
B4X:
Dim Cursor1 As Cursor
Dim query As String="SELECT * FROM records WHERE ID = John ORDER BY InsDate DESC LIMIT 1"
Cursor1 = MySub.SQL_Bls1.ExecQuery(query)
Cursor1.Position=0
Log(Cursor1.GetString("InsDate") & " - " & Cursor1.GetInt("Size"))
Thanks everybody, but anyway we are talking of using then the cursor to extract the columns.
The result of the query is just one record, so I have to set the cursor to 0 and scan the columns.
I was asking myself if, with ExecQuerySingleResult instead of ExecQuery, was possible to extract a whole record and not a single field.
look to my first post. I need to extract the most recent record of a certain Id, then scan the various column.
I did it with a cursor, how would you do in a single line ?