On 4 Feb 2017, at 3:31pm, Nigel Verity <[email protected]> wrote:
> My question regards the SQL I've used to populate the grid. I'm no SQL guru,
> so joining all the tables together in a single view using multiple nested
> left joins is probably beyond my comfort level.
You don’t have to nest the joins. You can put many JOINs in the same SELECT:
CREATE VIEW AllPhases AS
SELECT *, p1.a, p2.b, p3.c FROM Products
JOIN p1 ON p1.productID = Products.id
JOIN p2 ON p2.productID = Products.id
JOIN p3 ON p3.productID = Products.id
With only 5000 products you probably won’t notice any difference in
performance, but the above syntax will give you simpler code and if you lay it
out as above it will be easier for other people to understand.
Simon.
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users