Things You'll Need:
- A relational database
-
Step 1
DatabaseOpen your relational database. For my example I am using Microsoft's Northwind database, which is the database that comes with Microsoft.
-
Step 2
TablesI am going to use the orders table and the orders detail table and I will relate the two tables based on the Order ID field. Each order has a unique index called the order id. This order id is saved in the order details table since you can have multiple items purchased on the same order.
-
Step 3
SQL statementI selected a couple of fields from both tables so you can see how the data is returned. I then join the two tables on the order if field. So my SQL statement looks like this:
"SELECT [Order Details].OrderID, [Order Details].ProductID, Orders.OrderDate, Orders.ShippedDate, [Order Details].UnitPrice
FROM Orders, [order details] where Orders.OrderID = [Order Details].OrderID;"
Anything you see enclosed with [] means that the field or table name is more than one word using a space to separate the words. -
Step 4
Final resultsNow run your sql statement. You will see the fields selected displayed and the two tables joined.










Comments
joelsteph22 said
on 10/14/2008 helpful article... thanks!
luv2blog said
on 10/12/2008 Thanks for the info.