Google Groups Home
Help | Sign in
SQL Query Assistance
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Mark Braithwaite  
View profile
 More options 18 Aug 2008, 08:56
Newsgroups: microsoft.public.crm
From: Mark Braithwaite <MarkBraithwa...@discussions.microsoft.com>
Date: Sun, 17 Aug 2008 23:56:01 -0700
Local: Mon 18 Aug 2008 08:56
Subject: SQL Query Assistance
Hi

I have created an advanced find view which I have exported to a dynamic
worksheet. I have noticed that the 'Customer' and 'Resource' columns
disappear when I export to a worksheet.

I have attempted to edit the query and include the customer however I cannot
seem to get the correct results.

The original query was:
SELECT serviceappointment.subject ,
             serviceappointment.scheduledstart,
             serviceappointment.scheduledend,
             serviceappointment.regardingobjectidname ,
             serviceappointment.activityid ,
             serviceappointment.scheduleddurationminutes ,
             serviceappointment.createdon ,
             serviceappointment.serviceidname  
FROM FilteredServiceAppointment as serviceappointment
ORDER by serviceappointment.subject asc

In trying to add the customer column, my new query is:
SELECT serviceappointment.subject ,
             serviceappointment.scheduledstart,
             activitypartycustomer.partyidname,
             serviceappointment.scheduledend,
             serviceappointment.regardingobjectidname ,
             serviceappointment.activityid ,
             serviceappointment.scheduleddurationminutes ,
             serviceappointment.createdon ,
             serviceappointment.serviceidname  
FROM FilteredServiceAppointment as serviceappointment
INNER JOIN FilteredActivityParty as activitypartycustomer
ON serviceappointment.activityid = activitypartycustomer.activityid
ORDER by serviceappointment.subject asc

The problem is that this new query seems to return the resource and the
customer
in the same column. Would someone please assist me? I assume that I need to
inlcude a WHERE statement and another INNER JOIN for the resource column.

I would really appreciate anyone's assistance.

Thanks
Mark


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Braithwaite  
View profile
 More options 18 Aug 2008, 11:01
Newsgroups: microsoft.public.crm
From: Mark Braithwaite <MarkBraithwa...@discussions.microsoft.com>
Date: Mon, 18 Aug 2008 02:01:00 -0700
Subject: RE: SQL Query Assistance
Hi

I have tried the following query:

SELECT serviceappointment.subject ,
             serviceappointment.scheduledstart,
             activitypartycustomer.partyidname,
             resource.resourceid,
             serviceappointment.scheduledend,
             serviceappointment.regardingobjectidname ,
             serviceappointment.activityid ,
             serviceappointment.scheduleddurationminutes ,
             serviceappointment.createdon ,
             serviceappointment.serviceidname  
FROM FilteredServiceAppointment as serviceappointment
INNER JOIN FilteredActivityParty as activitypartycustomer
ON serviceappointment.activityid = activitypartycustomer.activityid
INNER JOIN FilteredResource as resource
ON resource.resourceid = serviceappointment.activityid
ORDER by serviceappointment.subject asc

This query was accepted however it did not return any data. I possibly just
need to include a WHERE statement.

Many Thanks
Mark


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Peter Lynch  
View profile
 More options 27 Aug 2008, 16:17
Newsgroups: microsoft.public.crm
From: "Peter Lynch" <discussi...@microsoft.com>
Date: Wed, 27 Aug 2008 15:17:46 +0100
Local: Wed 27 Aug 2008 16:17
Subject: Re: SQL Query Assistance
This ON clause cannot be right, and will cause the result set to be empty

ON resource.resourceid = serviceappointment.activityid

"Mark Braithwaite" <MarkBraithwa...@discussions.microsoft.com> wrote in
message news:52A3DF40-63FB-46A6-BD2C-B4913637BEDC@microsoft.com...


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Braithwaite  
View profile
 More options 28 Aug 2008, 16:08
Newsgroups: microsoft.public.crm
From: Mark Braithwaite <MarkBraithwa...@discussions.microsoft.com>
Date: Thu, 28 Aug 2008 07:08:01 -0700
Local: Thurs 28 Aug 2008 16:08
Subject: Re: SQL Query Assistance
Hi Peter

Thanks for your response. Do you have any idea as to how I can insert the
required columns.

Thanks
Mark


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ChrisC  
View profile
 More options 29 Aug 2008, 10:31
Newsgroups: microsoft.public.crm
From: ChrisC <chris.co...@vizola.com>
Date: Fri, 29 Aug 2008 01:31:10 -0700 (PDT)
Local: Fri 29 Aug 2008 10:31
Subject: Re: SQL Query Assistance
Without looking into this - check the partytype (???) column, you
should have different types for customer and resource -> partyidname.
You will get multiple rows for each serviceappointment, with the
different partytype in each row. To merge these you could either use
filtered subquery for each column rather than table join OR join twice
to the party table with an additional constraint of partytype in the
ON clause and thereby separate the columns on one row.
Hope this helps
Chris
http://mscrm4u.blogspot.com

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google