As an answer to myself, further tests with postgresql let me see that I 
need to replace the first left join by an inner join
> SELECT "Stock"."product_id" AS "Stock__product_id", 
> "Stock"."location_id" AS "Stock__location_id", "Stock"."on_hand_units" 
> AS "Stock__on_hand_units", "Stock"."committed_units" AS 
> "Stock__committed_units", "Stock"."on_order_units" AS 
> "Stock__on_order_units", "Stock"."on_hand_dollars" AS 
> "Stock__on_hand_dollars", "Stock"."exch_cost" AS "Stock__exch_cost", 
> "Stock"."last_exch_cost" AS "Stock__last_exch_cost", "Stock"."created" 
> AS "Stock__created", "Stock"."modified" AS "Stock__modified", 
> "Product"."id" AS "Product__id", "Product"."description" AS 
> "Product__description", "Product"."size_description" AS 
> "Product__size_description", "Product"."section_size" AS 
> "Product__section_size", "Product"."aspect_size" AS 
> "Product__aspect_size", "Product"."tire_rim_size" AS 
> "Product__tire_rim_size", "Product"."plg_type" AS "Product__plg_type", 
> "Product"."speed_rating" AS "Product__speed_rating", 
> "Product"."load_rating" AS "Product__load_rating", "Product"."side_wall" 
> AS "Product__side_wall", "Product"."created" AS "Product__created", 
> "Product"."modified" AS "Product__modified", "Location"."id" AS 
> "Location__id", "Location"."name" AS "Location__name", 
> "Location"."opensunday" AS "Location__opensunday", "Location"."created" 
> AS "Location__created", "Location"."modified" AS "Location__modified" 
> FROM "stocks" AS "Stock" LEFT JOIN "products" AS "Product" ON 
> "Stock"."product_id" = "Product"."id" LEFT JOIN "locations" AS 
> "Location" ON "Stock"."location_id" = "Location"."id" WHERE 
> "Product"."section_size" = 265 AND "Product"."aspect_size" = 70 LIMIT 100
>   
as in

INNER JOIN "products" AS "Product" ON "Stock"."product_id" = "Product"."id"
LEFT JOIN "locations" AS "Location" ON "Stock"."location_id" = 
"Location"."id"

but i don't have the slightest idea as what I need to do in cake to get 
that changed.

the relevant models are :

class Location extends AppModel
    {
            var $name = 'Location';
            var $hasMany = 'User,Stock,Sale,Salesstat';
    }

Class Product extends AppModel
 {
         var $name = 'Product';
         var $hasMany = 'Stock';
        
 }

class Stock extends AppModel
    {
            var $name = 'Stock';
            var $belongsTo = 'Product,Location';
                   
    }







--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"Cake PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to