Results 1 to 1 of 1

Thread: Duplicate joins for listview

  1. #1
    tnd
    tnd is offline Junior Member
    Join Date
    Nov 2006
    Posts
    1

    Default Duplicate joins for listview

    Sugar 4.5.0e / Apache 2.2.3 / PHP 5.1.6

    Hi,

    I have added an additional column from the Accounts table to the Opportunity ListView, the column i added was the account industry and I have copied the vardef definition for account_name.

    The query executes without a problem, however I noticed that the accounts table was being joined twice. Does anyone have any ideas what maybe causing this and how I could fix it.

    Many Thanks,

    Chris.

    Below is the query produced by Opportunity ListView

    Code:
    SELECT  opportunities.id , opportunities.name  ,
    jt0.name account_name, jtl0.account_id account_id ,
    jt1.industry industry_name, jtl1.account_id account_id, opportunities.sales_stage ,
    opportunities.amount_usdollar , opportunities.date_closed  , jt2.user_name assigned_user_name ,
    jt2.created_by assigned_user_name_owner  , 'Users' assigned_user_name_mod, opportunities.assigned_user_id
    FROM opportunities LEFT JOIN  accounts_opportunities jtl0
         ON opportunities.id=jtl0.opportunity_id  AND jtl0.deleted=0
         LEFT JOIN  accounts jt0 ON jt0.id=jtl0.account_id AND jt0.deleted=0 AND jt0.deleted=0
         LEFT JOIN  accounts_opportunities jtl1 ON opportunities.id=jtl1.opportunity_id AND jtl1.deleted=0
         LEFT JOIN  accounts jt1 ON jt1.id=jtl1.account_id AND jt1.deleted=0 AND jt1.deleted=0
         LEFT JOIN  users jt2 ON jt2.id= opportunities.assigned_user_id AND jt2.deleted=0 AND jt2.deleted=0
    where opportunities.deleted=0 LIMIT 0,21
    Last edited by tnd; 2006-11-07 at 11:32 AM. Reason: Added system details

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •