inner join in sqlite

fotosettore

Member
Licensed User
Longtime User
hi !
i do not understand if is possible to create a SELECT that use INNER JOIN
in b4a

this code
B4X:
Dim SQL1 As SQL 
Dim SQL2 As SQL 
Dim Cursor1 As Cursor

SQL1.Initialize(db_dir,"names.db",True)
SQL2.Initialize(db_dir,"work_area.db",True)
   
Cursor1 = SQL1.ExecQuery("SELECT * FROM names INNER JOIN work_area ON names.id = work_area.id")

gives me the right error "no such table:work_area"

if i use "SQL2.ExecQuery" gives the same error about "names"

so ... what is the right sintax in b4a to create a INNER JOIN ?

many thanks
peppe
 

fotosettore

Member
Licensed User
Longtime User
many thanks for you fast reply, erel

no unfortunately is not possible in direct way, because these are dbases already working in a web server where i cannot operate directly

so .. please advice me about alternative solution .

for example ... in your reply you said i'd need to create a unique database from them inside b4a and using b4a sintax ?
or what else ?

many thanks
peppe
 
Upvote 0

fotosettore

Member
Licensed User
Longtime User
many thanks erel
i'ts ok ... i will combine a unique database inside apk
yes i know that the queries are handled by the native SQLite engine.
i wanted to say that i must combine the two dbases inside b4a, using b4a programming

last question - please say me if i'm in mistake : is the no possibility to join a lack of sql library ?
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
The following link in post #81 claims it works, but I could not get the attach statement to work:
http://www.b4x.com/forum/basic4andr...8-join-two-different-database.html#post133565

I was using something like this:
B4X:
 Dim AttachDB As String
       AttachDB = "ATTACH DATABASE " & File.DirRootExternal & "/POC/" & "POCDroid_BE.db"   & " AS db2"
       SQL1.ExecNonQuery(AttachDB)
The error was Syntax Error code 1 near /
I am not convinced the ATTACH statement is supported in this SQLite engine.
 
Upvote 0
Top