0

I'm creating a report using SSRS BIDS. My query is not working in the report wizard although it is working in SQL Management Studio. I'm using SQL 2008 R2 and CRM 2011. Query is below

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)

The error

TITLE: Microsoft SQL Server Report Designer

An error occurred while the query design method was being saved. An item with the same key has already been added.


BUTTONS:

OK

4

1 回答 1

1

In Query Account Name is specified twice in select list
"FilteredBRE_keyhistory.bre_sendtoaccountidname AS [Account Name]". Please remove it or give different alias names. Then it will work fine... :)

于 2012-11-29T11:12:35.853 回答