?
Solved

How to format group by sql statement?

Posted on 2007-11-15
2
Medium Priority
?
806 Views
Last Modified: 2010-04-21
I would like the following output where each name is listed only once using sql 2000:

Name       count
name       4
name 2    1

I am getting:
Name       count
name       4
name       3
name 2    1
 
sql code I am using:
select co.name, count(n.attitude)  as Total
from customer c, coment n, subcompany co
group by co.name, c.indx, n.indx, n.attitude
having c.indx = n.indx and  c.company = co.code and n.indx = c.company

0
Comment
Question by:swansonplace
[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 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 2000 total points
ID: 20290784
select co.name, count(n.attitude)  as Total
from customer c
join coment n
  on c.indx = n.indx
 and n.indx = c.company
join subcompany co
  on c.company = co.code
group by co.name

0
 

Author Closing Comment

by:swansonplace
ID: 31409372
Thank you.  That was clean and it worked.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In database programming, custom sort order seems to be necessary quite often, at least in my experience and time here at EE. Within the realm of custom sorting is the sorting of numbers and text independently (i.e., treating the numbers as number…
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

650 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