yan9m5k6
Joined: 30 Mar 2011
Posts: 93
Read: 0 topics
Warns: 0/5
Location: England
|
Posted: Thu 8:57, 19 May 2011 Post subject: atmosphere jordan 1 How To Join Two Tables In A Re |
|
|
power of a relational database such as Oracle, SQL Server, MySQL and Access is the aptitude to relate two or more tables based on prevalent fields. Here is how you can combine two tables on a common field. I am using MS Access's Northwind database to jot the SQL expression.
1. Database Database Open your relational database. For my instance I am using Microsoft's Northwind database,[link widoczny dla zalogowanych], which is the database that comes with Microsoft.
2. Tables Tables I am going to use the orders chart and the orders detail table and I ambition narrate the 2 tables based on the Order ID field. Each mandate has a peerless index called the order id. This order id is saved in the order details table since you can have multiple items bought ashore the same order.
3. SQL statement SQL statement I selected a pair of fields from either tables so you can discern how the file is returned. I then join the two tables on the order if field. So my SQL statement looks favor this: "SELECT [Order Details].OrderID,[link widoczny dla zalogowanych], [Order Details].ProductID,[link widoczny dla zalogowanych],[link widoczny dla zalogowanych], Orders.OrderDate, Orders.ShippedDate, [Order Details].UnitPrice FROM Orders,[link widoczny dla zalogowanych],[link widoczny dla zalogowanych], [order details] where Orders.OrderID = [Order Details].OrderID;" Anything you discern encircled with [] means that the field or table appoint is more than one word using a space to separate the words.
4. Final results Final results Now sprint your sql statement. You will see the fields selected exhibited and the two tables joined.
The post has been approved 0 times
|
|