我正在使用SSRS BIDS创建报告。我的查询在报表向导中不起作用,尽管它在SQL Management Studio中工作。我正在使用SQL 2008 R2和CRM 2011. 查询位于
之下SELECT
FilteredBRE_licensee.bre_licensee AS Licensee,
CONVERT(varchar, FilteredBRE_licensee.bre_agreementdate, 101) AS [Agreement Day],
FilteredBRE_keyhistory.bre_keynumber_pk AS [Key],
FilteredBRE_keyhistory.bre_numoflicenses AS [# of licenses],
FilteredBRE_keyhistory.bre_billingdetailidname AS [Billing Detail],
FilteredBRE_keyhistory.bre_sendtoaccountidname AS [Account Name],
FilteredBRE_keyhistory.bre_assignedtocontactidname AS [Assigned To Contact],
FilteredBRE_keyhistory.bre_sendtoaccountidname AS [Account Name],
FilteredBRE_keyhistory.bre_sendtocontactidname AS [Send To Contact],
FilteredBRE_keyhistory.bre_billingcyclename AS [Billing Cycle],
FilteredBRE_licensee.bre_networkminimum AS [Network Minimum],
FilteredBRE_licensee.bre_networkoption AS [Network Option],
FilteredBRE_licensee.bre_pcoption AS [PC Option],
FilteredBRE_licensee.bre_combinedminimum AS [Combined Minimum],
FilteredBRE_licensee.bre_pcoptionname AS [PC Option Name],
FilteredAccount.bre_billing_address_line1 AS [Account Address Line 1],
FilteredAccount.bre_billing_address_line2 AS [Account Address Line 2],
FilteredAccount.bre_billing_address_line3 AS [Account Address Line 3],
FilteredAccount.bre_billing_address_city AS [Account Address City],
FilteredAccount.bre_billing_address_stateorprovince AS [Account Address State],
FilteredAccount.bre_billing_address_postalcode AS [Account Address Zip],
FilteredAccount.bre_billing_address_countryname AS [Account Address Country],
Billing_Contact.bre_billing_address_line1 AS [Billing Contact Address Line 1],
Billing_Contact.bre_billing_address_line2 AS [Billing Contact Address Line 2],
Billing_Contact.bre_billing_address_line3 AS [Billing Contact Address Line 3],
Billing_Contact.bre_billing_address_city AS [Billing Contact Address City],
Billing_Contact.bre_billing_address_stateorprovince AS [Billing Contact Address State],
Billing_Contact.bre_billing_address_postalcode AS [Billing Contact Address Zip],
Billing_Contact.bre_billing_address_countryname AS [Billing Contact Address Country],
Send_To_Contact.bre_billing_address_line1 AS [Send To Contact Address Line 1],
Send_To_Contact.bre_billing_address_line2 AS [Send To Contact Address Line 2],
Send_To_Contact.bre_billing_address_line3 AS [Send To Contact Address Line 3],
Send_To_Contact.bre_billing_address_city AS [Send To Contact Address City],
Send_To_Contact.bre_billing_address_stateorprovince AS [Send To Contact Address State],
Send_To_Contact.bre_billing_address_postalcode AS [Send To Contact Address Zip],
Send_To_Contact.bre_billing_address_countryname AS [Send To Contact Address Country]
FROM
FilteredBRE_keyhistory
INNER JOIN FilteredBRE_licensee ON FilteredBRE_keyhistory.bre_licenseeid = FilteredBRE_licensee.bre_licenseeid
INNER JOIN FilteredBRE_billingdetails ON FilteredBRE_licensee.organizationid = FilteredBRE_billingdetails.organizationid
INNER JOIN FilteredContact AS Billing_Contact ON FilteredBRE_billingdetails.bre_billingcontactid = Billing_Contact.contactid
INNER JOIN FilteredAccount ON FilteredBRE_billingdetails.bre_customeraccountid = FilteredAccount.accountid
INNER JOIN FilteredContact AS Send_To_Contact ON FilteredBRE_keyhistory.bre_sendtocontactid = Send_To_Contact.contactid
WHERE (FilteredBRE_keyhistory.bre_iscurrent = 1) AND (FilteredBRE_keyhistory.bre_status = 1)
错误
保存查询设计方法时发生错误。已添加具有相同密钥的项目。
按钮:
答案 0 :(得分:1)
在查询帐户名称中,在选择列表中指定了两次“FilteredBRE_keyhistory.bre_sendtoaccountidname AS [帐户名]”。请删除它或给出不同的别名。然后它会正常工作...... :)