Matt Froncek wrote:
What is the proper way nest my Left Outer Joins. In another ODBC driver I
can use:
SELECT count(TimeTracking.ROWID) FROM ((TimeTracking LEFT OUTER JOIN
Customer ON Customer.ListID = TimeTracking.CustomerRefListID) LEFT OUTER
JOIN Entity ON Entity.ListID = TimeTracking.EntityRefListID) LEFT OUTER JOIN
PriceLevelPerItem ON PriceLevelPerItem.ListID = Customer.PriceLevelRefListID
Matt,
The way to say this in SQLite is:
SELECT count(TimeTracking.ROWID)
FROM TimeTracking
LEFT OUTER JOIN Customer
ON Customer.ListID = TimeTracking.CustomerRefListID
LEFT OUTER JOIN Entity
ON Entity.ListID = TimeTracking.EntityRefListID
LEFT OUTER JOIN PriceLevelPerItem
ON PriceLevelPerItem.ListID = Customer.PriceLevelRefListID
But why do you want to do this?
A left join produces an output record for each record from the left table. The left table in the first join is the TimeTracking table. So you will get an output record for each record in this table. These records will be extended by data from the other tables where the conditions match, or by null columns. The only thing you are doing is counting the rowids from the leftmost table.
Your query is equivalent to
SELECT count(TimeTracking.ROWID)
FROM TimeTracking
I suspect you really want something else.
HTH
Dennis Cote