On Mon, Jul 28, 2014 at 3:10 PM, Drago, William @ MWG - NARDAEAST <william.dr...@l-3com.com> wrote: > All, > > Can someone tell me what the purpose of line 2 is in the following example? > It seems redundant to me since what is wanted from the Customers table is > specified on line 1. > > > 1: SELECT Customers.CustomerName, Orders.OrderID > 2: FROM Customers > 3: INNER JOIN Orders > 4: ON Customers.CustomerID=Orders.CustomerID > 5: ORDER BY Customers.CustomerName; > > The above example was found here: > > http://www.w3schools.com/sql/sql_join_inner.asp > > > Thanks, > -- > Bill Drago > Senior Engineer
To me, the entire SELECT looks like it is meant to list all orders with the CusteromerID in Orders and the associated CustomerName from Customers. But it does look sort of backwards to me as I probably would have coded: SELECT Customers.CustomerName, Orders.OrderID from Orders INNER JOIN Customers on Customers.CustomerID=orders.CustomerID order by Customers.CustomerName; But INNER JOIN is basically commutative, like addition, so both should result in the same result table. -- There is nothing more pleasant than traveling and meeting new people! Genghis Khan Maranatha! <>< John McKown _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users