aspose file tools*
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

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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: 107

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
I agree. Here's the link:
subject: SQL query needed
Similar Threads
Using Indexing concept for performance ?
Exception while retrieving the result from resultset
HQL to get all the records in one table but in not other
export query from table column to text file
How to get table name from oracle query?