I am using Crystal XI, and data from a MS SQL Server, and also Maximizer 9. There are 2 SQL tables (Serial_History & Customers) and 4 Maximizer views (Client, Events, Account Number, and Company Type).
I am selecting customers to show based on data in Maximizer, and then calculating units sold from the Invoices table.
This all works fine, except for a few customers, who have 2 entries in the Events view. For these customers, the calculated units sold is doubled.
The question then, is how do I select only distinct records from the Events table? I have tried all sorts of formulas, links, grouping, to no avail. The best I can manage is to suppress the detail record if it is a duplicate, but all of my summaries (sum) still count the duplicate.
My select query:
SELECT CLIENT.Name_Type, ACCOUNT_NUMBER.Account_Number, CLIENT.Client_Id, CLIENT.Contact_Number
FROM ACCOUNT_NUMBER ACCOUNT_NUMBER LEFT OUTER JOIN CLIENT CLIENT ON ACCOUNT_NUMBER.Client_Id=CLIENT.Client_Id
WHERE CLIENT.Name_Type='C'
SELECT "Customer"."Name", "Customer"."Blocked", "Customer"."No_"
FROM "syd"."dbo"."Customer" "Customer"
WHERE "Customer"."Blocked"<>1
SELECT "Serial_History"."Sell-to Customer", "Serial_History"."Invoiced Quantity", "Serial_History"."Item No_", "Serial_History"."Invoice No_", "Serial_History"."Credit Memo No_", "Serial_History"."Invoice Date", "Serial_History"."SalesPerson Code", "Serial_History"."Item Type", "Serial_History"."Family", "Serial_History"."Order Type"
FROM "syd"."dbo"."Serial History" "Serial_History"
WHERE ("Serial_History"."Invoice Date">={ts '2006-06-01 00:00:00'} AND "Serial_History"."Invoice Date"<{ts '2007-03-31 00:00:01'}) AND ("Serial_History"."Order Type"=0 OR "Serial_History"."Order Type"=1)
ORDER BY "Serial_History"."Sell-to Customer"
SELECT U_COMPANY_TYPE.U_Company_Type, U_COMPANY_TYPE.Contact_Number, U_COMPANY_TYPE.Client_Id
FROM U_COMPANY_TYPE U_COMPANY_TYPE
WHERE (U_COMPANY_TYPE.U_Company_Type='HOBAMember' OR U_COMPANY_TYPE.U_Company_Type='FOBAMember')
ORDER BY U_COMPANY_TYPE.U_Company_Type
SELECT U_EVENTS.U_Events, U_EVENTS.Contact_Number, U_EVENTS.Client_Id
FROM U_EVENTS U_EVENTS
WHERE U_EVENTS.U_Events='2007 HOBA Rego'
I am selecting customers to show based on data in Maximizer, and then calculating units sold from the Invoices table.
This all works fine, except for a few customers, who have 2 entries in the Events view. For these customers, the calculated units sold is doubled.
The question then, is how do I select only distinct records from the Events table? I have tried all sorts of formulas, links, grouping, to no avail. The best I can manage is to suppress the detail record if it is a duplicate, but all of my summaries (sum) still count the duplicate.
My select query:
SELECT CLIENT.Name_Type, ACCOUNT_NUMBER.Account_Number, CLIENT.Client_Id, CLIENT.Contact_Number
FROM ACCOUNT_NUMBER ACCOUNT_NUMBER LEFT OUTER JOIN CLIENT CLIENT ON ACCOUNT_NUMBER.Client_Id=CLIENT.Client_Id
WHERE CLIENT.Name_Type='C'
SELECT "Customer"."Name", "Customer"."Blocked", "Customer"."No_"
FROM "syd"."dbo"."Customer" "Customer"
WHERE "Customer"."Blocked"<>1
SELECT "Serial_History"."Sell-to Customer", "Serial_History"."Invoiced Quantity", "Serial_History"."Item No_", "Serial_History"."Invoice No_", "Serial_History"."Credit Memo No_", "Serial_History"."Invoice Date", "Serial_History"."SalesPerson Code", "Serial_History"."Item Type", "Serial_History"."Family", "Serial_History"."Order Type"
FROM "syd"."dbo"."Serial History" "Serial_History"
WHERE ("Serial_History"."Invoice Date">={ts '2006-06-01 00:00:00'} AND "Serial_History"."Invoice Date"<{ts '2007-03-31 00:00:01'}) AND ("Serial_History"."Order Type"=0 OR "Serial_History"."Order Type"=1)
ORDER BY "Serial_History"."Sell-to Customer"
SELECT U_COMPANY_TYPE.U_Company_Type, U_COMPANY_TYPE.Contact_Number, U_COMPANY_TYPE.Client_Id
FROM U_COMPANY_TYPE U_COMPANY_TYPE
WHERE (U_COMPANY_TYPE.U_Company_Type='HOBAMember' OR U_COMPANY_TYPE.U_Company_Type='FOBAMember')
ORDER BY U_COMPANY_TYPE.U_Company_Type
SELECT U_EVENTS.U_Events, U_EVENTS.Contact_Number, U_EVENTS.Client_Id
FROM U_EVENTS U_EVENTS
WHERE U_EVENTS.U_Events='2007 HOBA Rego'