fotosettore Member Licensed User Longtime User Jun 9, 2013 #1 hi ! i do not understand if is possible to create a SELECT that use INNER JOIN in b4a this code Code: Copy 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
hi ! i do not understand if is possible to create a SELECT that use INNER JOIN in b4a this code Code: Copy 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
Erel B4X founder Staff member Licensed User Longtime User Jun 9, 2013 #2 You cannot join tables from two different databases. Can't you combine the databases to a single database? Upvote 0
You cannot join tables from two different databases. Can't you combine the databases to a single database?
fotosettore Member Licensed User Longtime User Jun 9, 2013 #3 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
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
Erel B4X founder Staff member Licensed User Longtime User Jun 9, 2013 #4 Note that there is no such thing as b4a syntax. The queries are handled by the native SQLite engine. You can create a new (memory?) database and copy the tables to the new database. You will then be able to join them. Upvote 0
Note that there is no such thing as b4a syntax. The queries are handled by the native SQLite engine. You can create a new (memory?) database and copy the tables to the new database. You will then be able to join them.
fotosettore Member Licensed User Longtime User Jun 9, 2013 #5 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
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 ?
M Mahares Expert Licensed User Longtime User Jun 9, 2013 #6 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: Code: Copy 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
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: Code: Copy 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.