Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within JDBC and Relational Databases
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
JDBC and Relational Databases
print only the duplicate values in sql.
bhavin ragha
Greenhorn
Posts: 17
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
is there a method that will allow me to print only the duplicate values
here in a column
--------
1
1
2
3
3
the out put would be
---------
1
3
William P O'Sullivan
Ranch Hand
Posts: 859
I like...
posted 11 years ago
1
Number of slices to send:
Optional 'thank-you' note:
Send
Native sql, you could execute this in a
Java
method ...
select colname from tablename
order by colname
group by colname having count(*) > 1;
Try it ...
Then understand what the "group by" and "having" do
Pat.
bhavin ragha
Greenhorn
Posts: 17
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
i put this in and it did not work for me. it says "near "group": syntax error"
select releases.cd_id from releases
order by releases.cd_id
group by releases.cd_id
having count(*) > 1
Martin Vashko
Sheriff
Posts: 3837
66
I like...
posted 11 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Move the
order by
clause to the end of the statement.
Order by
must always go last.
See where your hand is? Not there. It's next to this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Question on HashSet
use a *semantically* correct type if possible?
best way to delete duplicate
Marcus Green Q=21 Collection
String comparision
More...