Welcome Guest, Not a member yet? Register   Sign In
DMZ object in foreach
#3

[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?


Messages In This Thread
DMZ object in foreach - by El Forum - 09-04-2010, 07:45 AM
DMZ object in foreach - by El Forum - 09-05-2010, 08:16 AM
DMZ object in foreach - by El Forum - 09-05-2010, 09:05 AM
DMZ object in foreach - by El Forum - 09-05-2010, 09:22 AM
DMZ object in foreach - by El Forum - 09-05-2010, 09:35 AM



Theme © iAndrew 2016 - Forum software by © MyBB