Jump to content

zend framework LEFT JOIN incorectly named columns as columnname compensate


nadeemshafi9

Recommended Posts

hello guys

 

i am using zend frameworks LEFT JOIN  prepaired query.

 

my query works fine in navicat, i get all the rows from the left with any appended childeren from the right.

 

in zend thogh my results dont come out with the tablename appended to them, so any duplicate columns from both tables get overwriten or blank unless i use the AS opperator.

 

the funny thing is i get the right tables stuff as the default ed id is from the right table and that takes presidence over the lef unless i bring teh lefts id in using lefttbl.id as lefttbl.id, but i want it to be id.

 

$result 	 = $conference_table->fetchAll($conference_table->select()
    											->from('radius.confcheck as c',array(
    												'c.user as c.user',
												'c.pass as c.pass',
												'c.max_users as c.max_users',
												'c.current_users as c.current_users',
												'c.host_id as c.host_id',
												'c.portal_id as c.portal_id',
												'c.startdate as c.startdate',
												'c.expiredate as c.expiredate',
												'c.created as c.created',
												'c.test as c.test',
												'c.created_by as c.created_by',
												'c.reference as c.reference',
												'c.invoiced as c.invoiced',
												'c.id as c.id',
												'c.invoice_id as c.invoice_id',
												'c.roaming as c.roaming',
												'c_e.id as c_e.id',
												'c_e.invoice_id as c_e.invoice_id',
												'c_e.conf_id as c_e.conf_id',
												'c_e.name as c_e.name',
												'c_e.purchase_order_id as c_e.purchase_order_id',
												'c_e.invoiced as c_e.invoiced'))
    											->order(array("{$sort} {$dir}"))
    											->joinLeft('irh_net.confcheck_extra as c_e', 'c.id = c_e.conf_id')
    											->setIntegrityCheck(false)
    											->where("c.id = '2213'")
											->limit($limit, $start));
        	$conferences = $result->toArray();
        
        	print_r($conferences);
        	die();

 

 

Array

(

    [0] => Array

        (

            [c.user] => dfgtr6y45

            [c.pass] => *****

            [c.max_users] => 4

            [c.current_users] => 0

            [c.host_id] => 0

            [c.portal_id] => 111

            [c.startdate] => 1247578474

            [c.expiredate] => 1247751277

            [c.created] => 2009-07-14 14:35:22

            [c.test] => 0

            [c.created_by] => 71

            [c.reference] =>

            [c.invoiced] => 2009-07-14

            [c.id] => 2213

            [c.invoice_id] => sdfw34

            [c.roaming] => 0

            [c_e.id] => 5

            [c_e.invoice_id] => sdfw34

            [c_e.conf_id] => 2213

            [c_e.name] => fdsgedfger

            [c_e.purchase_order_id] => dfg54654

            [c_e.invoiced] => 2009-07-14

            [id] => 5                        ------ this is from teh right

            [conf_id] => 2213                        ------ this is from teh right

            [purchase_order_id] => dfg54654                        ------ this is from teh right

            [name] => fdsgedfger                        ------ this is from teh right

            [invoiced] => 2009-07-14                        ------ this is from teh right

            [invoice_id] => sdfw34                        ------ this is from teh right

        )

 

)

 

i limited it to 1 row using where id = because i know the whole lot works and i need you to see one with a right child

 

thanks for any help ??

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.