Can the active record class do this with a LEFT JOIN?

#1
[eluser]Crucial[/eluser]
I have a query I'm trying to run using the ARC, and it's not producing any results. If I leave it as a full statement using just the query call, it works fine. I think the problem comes from the LEFT JOIN, because the user guide doesn't seem to allow what I'm trying to do.

Below is my query:

Code:
SELECT
    packages.package_price,
    client_packages.client_package_cycle,
    client_packages.client_package_discount,
    client_packages.package_price
FROM
    client_packages
LEFT JOIN
    client_details
ON
    client_details.client_id = client_packages.client_id,
    packages
WHERE
    client_packages.package_id = packages.package_id
AND
    client_details.client_status = '2'
AND
    client_packages.client_package_status = '2'
AND
    client_packages.client_package_cycle = '1'

And here's the ARC code I'm using:

Code:
$mb->select('packages.package_price, client_packages.client_package_cycle, client_packages.client_package_discount, client_packages.package_price');
$mb->from('client_packages');
$mb->join('client_details', 'client_details.client_id = client_packages.client_id, packages', 'left');
$mb->where('client_package.pack_id', 'packages.package_id');
$mb->where('client_details.client_status', '2');
$mb->where('client_packages.client_package_status', '2');
$mb->where('client_packages.client_package_cycle', '1');

I'm using multiple databases, which is why it isn't $this->db->blah. Any help would be appreciated.


Messages In This Thread
Can the active record class do this with a LEFT JOIN? - by El Forum - 03-26-2008, 03:26 PM
Can the active record class do this with a LEFT JOIN? - by El Forum - 03-26-2008, 04:03 PM
Can the active record class do this with a LEFT JOIN? - by El Forum - 03-26-2008, 04:06 PM
Can the active record class do this with a LEFT JOIN? - by El Forum - 03-26-2008, 04:22 PM
Can the active record class do this with a LEFT JOIN? - by El Forum - 03-26-2008, 04:26 PM
Can the active record class do this with a LEFT JOIN? - by El Forum - 03-26-2008, 04:39 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.