wood burning stoves 2.0*
The moose likes JDBC and the fly likes SQL query needed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "SQL query needed" Watch "SQL query needed" New topic

SQL query needed

Nagendra Shastry

Joined: Oct 26, 2010
Posts: 19
Hi All,

I am a student on Computer Science and not having much knowledge. So please don't mind if my quesrion is silly.
I need to write a sql query to group by a column where column has duplicate values( having count more than one)
Please help me out.
T Mishra
Ranch Hand

Joined: Apr 04, 2006
Posts: 108

Hi Nagendra ,

It would be really helpful if you can tell us details about what you've tried so far and the problem you're facing.

Tushar (SCJP 1.5)
Shashank Gollapudi
Ranch Hand

Joined: Jan 19, 2012
Posts: 33
Hi Nagendra,

As per what i have understood,

Let x be the column you wanted to find duplicates on,

use group by clause on x then followed by having clause using the count function

For example: Select x from sometable group by x having count(x) > 1
It is sorta covered in the JavaRanch Style Guide.
subject: SQL query needed
Similar Threads
export query from table column to text file
How to get table name from oracle query?
Exception while retrieving the result from resultset
Using Indexing concept for performance ?
HQL to get all the records in one table but in not other