Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SubQuery in a Data Foundation

Status
Not open for further replies.

DarkAngel

Technical User
Jan 5, 2001
73
US
I created a Data Foundation (DF) in Business View Manager (BVM). Then added a command which is the subquery below (to get max ServiceID where BonusType is NULL. Then added left join from the Appoinment table to the command on the AppointmentID field. Trying to accomplish in the DF what is being done in the following SQL:


SELECT DISTINCT (Customer.LName + '', '' + Customer.FName) AS CustName, Customer.CustomerID, Appointment.Date, Service.BilledOn, Service.Units,

FROM Appointment
LEFT JOIN Service ON Appointment.AppointmentID = Service.AppointmentID AND ServiceID IN
(SELECT MAX(ServiceID) AS ServiceID
FROM Appointment APID
INNER JOIN Service S ON S.AppointmentID = Appointment.AppointmentID
WHERE Appointment.AppointmentID = APID.AppointmentID AND S.BonusType IS NULL
GROUP BY Appointment.AppointmentID)

INNER JOIN Customer ON Appointment.CustomerID = Customer.CustomerID
ORDER BY S


The command produces the desired result when run on its own and when joined to the Appoinment table in Crystal Reports. However, same table/command/join in the DF returns all AppointmentIDs even if BonusType is null.

Any direction is appreciated.
 
Meant to include...

Crystal Reports 2008
BusinessObjects Enterprise XI 3.1
MS SQL Server 2005 (SQL Server 9.0.4035)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top