J junaidahmed Well-Known Member Licensed User Longtime User Jun 25, 2011 #1 How to Join Two Different Database Table in SQLite,For Example Select Code,Amount from Account ---> Database1 Select Code,Amount from Account ---> Database2 Pls advise
How to Join Two Different Database Table in SQLite,For Example Select Code,Amount from Account ---> Database1 Select Code,Amount from Account ---> Database2 Pls advise
Erel B4X founder Staff member Licensed User Longtime User Jun 25, 2011 #2 You will need to manually read the data and insert it into the other database. Upvote 0
M Merlot2309 Active Member Licensed User Longtime User Jun 25, 2011 #3 Hello, To use data in/from different tables you have 1 joint value/field in each table. What I use is more or less the following: Dim a Variable in the Process Globals (e.g. Name) so I can use the value in other forms and then I get the value of this variable like this: Code: Copy crInfo = [I]SQLDatabaseName[/I].ExecQuery2("Select * FROM [I]Tablename[/I] WHERE Name = ?", Array As String([I]Variable[/I])). The same goes for deleting and updating records. Regards, Helen. Upvote 0
Hello, To use data in/from different tables you have 1 joint value/field in each table. What I use is more or less the following: Dim a Variable in the Process Globals (e.g. Name) so I can use the value in other forms and then I get the value of this variable like this: Code: Copy crInfo = [I]SQLDatabaseName[/I].ExecQuery2("Select * FROM [I]Tablename[/I] WHERE Name = ?", Array As String([I]Variable[/I])). The same goes for deleting and updating records. Regards, Helen.
padvou Active Member Licensed User Longtime User Nov 6, 2012 #4 So, can it be done or not? I 'm afraid i 've not understood the answer.. Upvote 0
mc73 Well-Known Member Licensed User Longtime User Nov 6, 2012 #5 Sure. You can declare two sql objects for each database, perform your queries, and if needed insert data from one database to the other. Upvote 0
Sure. You can declare two sql objects for each database, perform your queries, and if needed insert data from one database to the other.
K keirS Well-Known Member Licensed User Longtime User Nov 6, 2012 #6 Yes it can be done. You can use the the ATTACH DATABASE command to attach one database to another. Code: Copy DIM oSQL AS SQL oSql.Initialize(File.DirRootExternal & "/databases","database1.db",False) cSQLAttach = "ATTACH DATABASE " & File.DirRootExternal & "/dasbases/" & "database2.db" & " AS db2" oSql.ExcNonQuery(cSQLAttach) This would mean you could join tables from database1 to database2 in one SQL query. So in your case you could do. "SELECT Account.CODE, Account.Amount, DB2.Account.code "code2", DB2.Account.Amount "amount2" FROM Account, DB2.Account WHERE Account.CODE = DB2.Account.CODE Last edited: Nov 6, 2012 Upvote 0
Yes it can be done. You can use the the ATTACH DATABASE command to attach one database to another. Code: Copy DIM oSQL AS SQL oSql.Initialize(File.DirRootExternal & "/databases","database1.db",False) cSQLAttach = "ATTACH DATABASE " & File.DirRootExternal & "/dasbases/" & "database2.db" & " AS db2" oSql.ExcNonQuery(cSQLAttach) This would mean you could join tables from database1 to database2 in one SQL query. So in your case you could do. "SELECT Account.CODE, Account.Amount, DB2.Account.code "code2", DB2.Account.Amount "amount2" FROM Account, DB2.Account WHERE Account.CODE = DB2.Account.CODE
I Itila Tumer Active Member Licensed User Longtime User Feb 24, 2014 #9 I have a persons db, and have person table too. I have TabHost of three . ı want to see different tables in each page. What do you recommend me ? Upvote 0
I have a persons db, and have person table too. I have TabHost of three . ı want to see different tables in each page. What do you recommend me ?
Erel B4X founder Staff member Licensed User Longtime User Feb 24, 2014 #10 Please start a new thread for this question. Upvote 0