Solved

Need help composing a SQL statement

Posted on 2012-03-21
7
240 Views
Last Modified: 2012-03-26
Have a look at my attached xls file.  It provides the tables I'm referring to and the two sets of results (scroll right to see them) I'm looking to return.

I need both statement to return values based on the EventID and the number of Leads based on that EventID.

I'm really hoping someone can help me because I don't even know where to being.  It is just too advanced for me.  

Could someone please look at my problem and post the T-SQL statement that would return my desired result?  Thanks You.  I'm truly stumped.
Report-Help.xls
0
Comment
Question by:cdemott33
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 69

Expert Comment

by:Scott Pletcher
ID: 37747886
I'm not seeing anything in the attachment.
0
 

Author Comment

by:cdemott33
ID: 37747984
Let me try again.
Report-Help.xls
0
 
LVL 69

Expert Comment

by:Scott Pletcher
ID: 37748024
Nope, still nothing.  Maybe it's my version of Excel (2010)?
0
Major Incident Management Communications

Major incidents and IT service outages cost companies millions. Often the solution to minimizing damage is automated communication. Find out more in our Major Incident Management Communications infographic.

 

Author Comment

by:cdemott33
ID: 37748084
Very odd.  I'm saving it as an Excel 97-2003 file so it should open up in 2010 without issue.  Let me try something different.  Please stand by.
0
 

Author Comment

by:cdemott33
ID: 37748128
I convert it into a PDF file.  You'll have to zoom in to see it but hopefully you can open this up and see the data.
Report-Help.pdf
0
 
LVL 69

Expert Comment

by:Scott Pletcher
ID: 37748208
OK, I can see it.
0
 
LVL 39

Accepted Solution

by:
appari earned 500 total points
ID: 37750777
try this
Select 
 A.AnswerOption, count(L.LeadID)
From Answers A Join Question Q
on A.QuestionID = Q.QuestionID
Left Outer Join QuestionnaireResults QR
on QR.QuestionID = Q.QuestionID 
and A.AnswerID = QR.AnswerID
Left outer join Leads L
on QR.LeadID = L.LeadID
where L.EventID=1
Group by A.AnswerOption

Open in new window

0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question