Login or Sign up Help | Site Map
Connecting Tech Pros Worldwide

SQL Query Assistance

Question posted by: Mark Braithwaite (Newbie) on July 1st, 2008 01:34 PM
Hi

We are using Microsoft CRM and we have exported a list of service activities to a dynamic Excel worksheet. I have attempted to insert the name of customers that are related to service activities in the worksheet. When editing the SQL query I used the following script;

SELECT activitypartycustomer.partyidname,
serviceappointment.subject ,
serviceappointment.scheduledstart ,
serviceappointment.scheduledend ,
serviceappointment.regardingobjectidname ,
serviceappointment.activityid ,
serviceappointment.scheduleddurationminutes ,
serviceappointment.serviceidname
FROM FilteredServiceAppointment as serviceappointment
INNER JOIN FilteredActivityParty as activitypartycustomer
ON serviceappointment.activityid = activityparty.activityid
WHERE (serviceappointment.scheduledendutc >= dbo.fn_BeginOfLastMonth(GetUTCDate()) and serviceappointment.scheduledendutc < dbo.fn_EndOfLastMonth(GetUTCDate()) and serviceappointment.ownerid = N'{4DEA2FCF-D238-DB11-A907-00137259CAFC}')

It seemed to be successful however the partyid column contained the name of the owner of the service activity and below that row the name of the customer.

I am sure it is the ON statement that is giving problems. I would really appreciate any assistance.

Thanks
M
Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
debasisdas's Avatar
debasisdas
Moderator
6,448 Posts
July 2nd, 2008
09:37 AM
#2

Re: SQL Query Assistance
I don't think there is any error with the query . It does what it is being asked to do in the syntax. If your requirment is different you might need to change the join part . It is really difficult to predict without the table structure.

Reply
Reply
Not the answer you were looking for? Post your question . . .
182,266 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Top Microsoft SQL Server Contributors