SQL querry to join 2 tables from access dB
Hello,
Can anyone here guide me how to write the query to find Two tables within the available database and it should be possible to join then and then to retrieve both the username and the any other field from the table, any other table this is because it would be the custom table field which we could change at any time further.
Thanks
Re: SQL querry to join 2 tables from access dB
I have some doubts and these are as follows the two tables which you wanted to join are located in the same Access file or these are two different Access files. These two tables would be changed in the future?
I had created the join table with the existing two tables and when the New table will be created that was the result of the previous two was required Access 2000 or higher required.
Re: SQL querry to join 2 tables from access dB
Basically whenever you wanted to join to tables you need to join your tables on a common field (has to be same data type),that is we could say the Key value. You may want to read into relationships:
and for that you need to write like this relation:
Code:
SELECT l.FullName, n.FullName, m.CMNumber, m.NotificationList
FROM Login l INNER JOIN Main m ON m.MainToLogin=l.MainToLogin INNER JOIN Notify n ON l.FullName=n.FullName
WHERE n.Email = m.NotificationList
The Starting name or letters would be the aliases for tables. The first criteria was unnecessary because of the second inner join.
Re: SQL querry to join 2 tables from access dB
Following are the steps that you need to follow to join two tables:
Step1:
Select and Open your database server it would be anything i.e. Access, SQL Server, Oracle, MySQL
Step 2:
If you have the database related to your customer or a product data Load it into your actual database.
Step 3
Porduct Database
Customers records etc.
Step 4
Select the Table with which you wanted to apply a join function such as Orders
Step 5
To join these two tables on the customer ID field. following query should be fired
Code:
SELECT customers.*,orders.* FROM customers,orders WHERE customers.customerid = orders.customerid
The above statement says, give me all of the data from the customers table and from the orders table where the customer_id fields are equal to one another.
Step 6
Once this done you would see the Final Results in the next table.