All,

I have searched the posts, but can't seem to locate the problem that I
am having. I have the following query that I would like to duplicate
with pagination:

select t1.nomenclature as lev1,
t1.barcode as lev1_barcode,
t2.nomenclature as lev2,
t2.parent_id as lev2_parent_id
from site_inventories t1
left join site_inventories as t2 on t1.barcode = t2.parent_id
where upper(substring(t1.parent_id,1,4)) in ('RACK','ROOM','LOCA')
and t1.site_name = 'Fort ABC'

This is what I have tried so far:

                var $paginate = array(
                                'fields' => array(
                                    'SiteInventory.id',
                  'SiteInventory.barcode',
                  'SiteInventory.model_id',
                  'SiteInventory.rcn',
                  'SiteInventory.doc_no',
                 'SiteInventory.nomenclature',
                 'SiteInventory.parent_id',
                 'SiteInventory.site_name',
                 'SiteInventory.location',
                 'SiteInventory.equip_type_id',
                'SiteInventory.site_id'),
                'limit' => 100,
                'page' => '1',
                'order' => array(
                  'SiteInventory.site_id,
                   SiteInventory.parent_id,
                   SiteInventory.barcode' => 'ASC'
              ),
              'joins' => array(
                array(
                  'table' => '`SiteInventory`',
                  'alias' => '`Child`',
                  'type' => 'LEFT',
                  'conditions' => array('Child.parent_id =
                                    SiteInventory.barcode')),
                                                              )
              );

This doesn't perform the left join. Any help would be appreciated.
Thanks in advance,.

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

Reply via email to