I'm displaying data in a grid using a prepareColumns function.

I have two tables I want to join table "admin_user"


table "customer_group" where both have 'customer_group_id' and I want to display the 'customer_group_code' from the "customer_group" table

I did something similar to this before to display the admin role ID using this code:

$collection = Mage::getResourceModel('admin/user_collection');
            array('ar' =>'admin_role'),
            'ar.user_id = main_table.user_id'
        ) ->join(
            array('ar2' => 'admin_role'),
            'ar.parent_id = ar2.role_id',

I then tried to add onto the collection using:

              array('ar' => 'admin_role'),
                'ar.customer_group_id = customer_group.customer_group_id',

But this gives me an error :( not sure what's wrong.

1 Answer 1


Ah foolish of me I realized main_table is the table I'm already currently in. I just had to join them as if they were two separate tables then look at customer_group_code in the second table.

Here is the code I used incase anyone has this problem:

          array('cg' => 'customer_group'),
            'main_table.customer_group_id = cg.customer_group_id',

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.