Query more than 2 tables
-
I am using vb6.0 for my application and connect to ms access 2000 database. I have 2 tables, table1 and table2. table1 is the parent and table2 is dependent on table1. for example, table1 has these columns, a1,a2,a3,a4,a5,a6,a7 and table2 has a1,a2,b1,b2,b3,b4,b5. a1 and a2 are the primary keys hence they link the two tables. the relationship is 1-many. now i have i form in vb and i want a uqery that is when i supply a parameter to search for, it has to look in both tables and display the results in 1 form but from two tables, table1 and table2. In access this is not a problem since i can create two forms based on the tables and then let the other form be a parent and the other a child, but in vb, I have no idea. Can anyone help. phokojoe
-
I am using vb6.0 for my application and connect to ms access 2000 database. I have 2 tables, table1 and table2. table1 is the parent and table2 is dependent on table1. for example, table1 has these columns, a1,a2,a3,a4,a5,a6,a7 and table2 has a1,a2,b1,b2,b3,b4,b5. a1 and a2 are the primary keys hence they link the two tables. the relationship is 1-many. now i have i form in vb and i want a uqery that is when i supply a parameter to search for, it has to look in both tables and display the results in 1 form but from two tables, table1 and table2. In access this is not a problem since i can create two forms based on the tables and then let the other form be a parent and the other a child, but in vb, I have no idea. Can anyone help. phokojoe
hi there, u need to have sql query foundation. to query from more than 2 tables, u might to use the JOINT clause for more information, u can read from MS SQL Online book << >>
-
I am using vb6.0 for my application and connect to ms access 2000 database. I have 2 tables, table1 and table2. table1 is the parent and table2 is dependent on table1. for example, table1 has these columns, a1,a2,a3,a4,a5,a6,a7 and table2 has a1,a2,b1,b2,b3,b4,b5. a1 and a2 are the primary keys hence they link the two tables. the relationship is 1-many. now i have i form in vb and i want a uqery that is when i supply a parameter to search for, it has to look in both tables and display the results in 1 form but from two tables, table1 and table2. In access this is not a problem since i can create two forms based on the tables and then let the other form be a parent and the other a child, but in vb, I have no idea. Can anyone help. phokojoe
Selecting from multiple tables requires more grip on SQL. I have simplest way which I mostly apply when I use Access for Backhand. In access, establish relationship between tables. You might me aware. Run Query Wizard. Select Both tables in the query window. In the bottom grid select desired fields form desired table. Run the query will give you some result about selected or filtered data. In the View Menu, Choose SQL View. SQL Query in the standard format will appear in a textfield to copy it to any where. This query can be used in ADO.