[eluser]frist44[/eluser]
I actually never wanted to call that product from the view, plus it created a select sql statement foreach in the loop and that seemed excessive. For some reason I'm still having trouble getting it out. I'm trying to essentially get the following sql statement out. Notice that there's only one product, for each order, and the product is joined to a sheet as well. So i'd like to have all 3 levels accessible in the view:
Code:
SELECT `orders`.`id`, `orders`.`quantity`, `orders`.`reconciled`, `orders`.`created`, `products`.`finish`, `sheets`.`geometry`
FROM (`orders`)
JOIN `products` ON `orders`.`product_id` = `products`.`id`
JOIN `sheets` ON `products`.`sheet_id` = `sheets`.`id`
ORDER BY `orders`.`id` DESC
So each order will have one product, so it doesn't necessary to have to loop foreach on each product within the foreach of the order right?