Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Need SQL Debug Help

Posted on 2014-02-13
3
Medium Priority
?
263 Views
Last Modified: 2014-02-13
I have a query that's running just fine until I try to add a GROUP BY clause. I have no formal SQL training and have tried a number of approaches but cannot figure out how to get the GROUP BY to work. Is there a DBA or SQL Jock out there who can help me with a GROUP BY on a query involving coalesce? Much appreciated.
GROUP-BY-NOT-WORKING.docx
0
Comment
Question by:gberkeley
[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
  • 2
3 Comments
 
LVL 34

Accepted Solution

by:
Brian Crowe earned 2000 total points
ID: 39857818
You're not using any aggregate functions that I can see so why are you grouping?  If your intent is to eliminate duplicate rows then just use DISTINCT.

SELECT DISTINCT <column list>
FROM HAR_CALLS
LEFT OUTER JOIN CALL_DISABILITY
    ON HAR_CALLS.CALL_UUID = CALL_DISABILITY.CALL_UUID
WHERE HAR_CALLS.START_DATE >= N'10/01/2012 00:00:00'
   AND HAR_CALLS.START_DATE <= N'10/31/2012 12:59:59'
0
 

Author Comment

by:gberkeley
ID: 39857822
Testing - thank you for the fast help!
0
 

Author Closing Comment

by:gberkeley
ID: 39857833
Thank you for the quick help and I learned something new!
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

670 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