Solved

Need SQL Debug Help

Posted on 2014-02-13
3
246 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
  • 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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
access denied when running native SQL tool: SQLIOSIM 2 26
SQL Server - Slabs 9 40
T-SQL:  I Want "Summary"--Not "Detail" 6 22
sql server group by every 2hrs 5 21
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
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.

863 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now