troubleshooting Question

Microsoft Query / SQL

Avatar of tmccull2
tmccull2Flag for United States of America asked on
DatabasesMicrosoft SQL ServerMicrosoft Excel
3 Comments1 Solution885 ViewsLast Modified:
I need help adding paramters (begindate1,enddate1,begindate2,enddate2) to replace the hard coded dates in this sql statement. The statement below works fine in Microsoft Query and returns the data to Excel 2003. I'd like the parameters to be populated by cell values in the Excel worksheet.  Thanks!

SELECT Principal,    SUM(Case When Date BETWEEN '1-1-2006 00:00:00.000' AND '12-31-2006 00:00:00.000' THEN Amount else 0 end),    SUM(Case When Date BETWEEN '1-1-2007 00:00:00.000' AND '12-31-2007 00:00:00.000' THEN Amount else 0 end)     FROM dbo.Results    GROUP BY Principal    ORDER BY Principal ASC
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros