Solved

Need SQL Debug Help

Posted on 2014-02-13
3
262 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 500 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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

632 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