Listing 1. A Fairly Inefficient Query
SELECT Orders.SalesRepID, Bikes_ColorsAvailable.Color,
OrderDetails.BuildABikeID, Orders.OrderDate,
BuildABike.ColorID, Bikes_BasicFrameTypes.FrameName,
Reps.Rep, BuildABike.Frame, Orders.CustID,
Orders.OrderID, OrderDetails.PartID, Orders.ShipDate,
BuildABike.BikeState
FROM (Reps RIGHT JOIN Orders ON
Reps.RepID = Orders.SalesRepID) INNER JOIN
(((Bikes_BasicFrameTypes INNER JOIN
(OrderDetails INNER JOIN BuildABike ON
OrderDetails.BuildABikeID = BuildABike.BuildABikeID) ON
Bikes_BasicFrameTypes.FrameTypeID =
BuildABike.FrameTypeID) INNER JOIN
Bikes_ColorsAvailable ON BuildABike.ColorID =
Bikes_ColorsAvailable.ColorID)
INNER JOIN Contacts_CurrentFrame_BABID ON
BuildABike.BuildABikeID =
Contacts_CurrentFrame_BABID.BuildABikeID)
ON Orders.OrderID = OrderDetails.OrderID
WHERE (((OrderDetails.PartID)=6502))
ORDER BY Orders.OrderDate DESC;
Copyright © 1994 - 2018 Linux Journal. All rights reserved.