Solved

SQL having count greater than 1

Posted on 2003-11-11
2
19,494 Views
Last Modified: 2009-12-24
Hi all,
i need help with some sql.  I have a table with 200,000 rows of data.  one of the columns ref contains non unique values.  I'm only interested in these rows if the ref values are not unique.  If this is the case i'd like to know how many times they are being used.

i would expect my select statement to return just 2 values, namely ref and the number of times ref value was used in the table.

any suggestions?

regards Peewee
0
Comment
Question by:Peewee
[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 6

Accepted Solution

by:
lausz earned 50 total points
ID: 9721787
Try this

select namely , count(*)
from yourtable
group by namely
having count(*)>1
0
 
LVL 5

Author Comment

by:Peewee
ID: 9721816
aplogies done it with...

set rowcount 10000

select ref, count(ref) as cnt from order
where ref != null
and ref != ''
group by ref
having count(ref) > 1
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Recently I was talking with Tim Sharp, one of my colleagues from our Technical Account Manager team about MongoDB’s scalability. While doing some quick training with some of the Percona team, Tim brought something to my attention...
Your data is at risk. Probably more today that at any other time in history. There are simply more people with more access to the Web with bad intentions.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

630 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