I want to fetch all duplicate values in sql. I searched at many places, but I don’t get what I exactly want. My table is like this:
company_id | supplier_id | company_name | organisation_no | type | sold_date
----------------------------------------------------------------------------
121234 | 934575 | fgdf | 12345 | sold | 2011-12-2
214365 | 423234 | sdgd | 5678 | sold | 2011-12-2
546534 | 234234 | bvcv | 3333 | sold | 2011-12-2
276345 | 243324 | dfgd | 12345 | sold | 2011-12-2
432642 | 567647 | ghmj | 12345 | sold | 2011-12-2
846578 | 365356 | egff | 3333 | sold | 2011-12-2
254334 | 346535 | yuuy | 7890 | sold | 2011-12-2
The solution I found is like this:
organisarion_no | count(organisation_no)
----------------------------------------
3333 | 2
12345 | 3
But I want exactly like this:
company_id | supplier_id | company_name | organisation_no | type | sold_date
----------------------------------------------------------------------------
546534 | 234234 | bvcv | 3333 | sold | 2011-12-2
846578 | 365356 | egff | 3333 | sold | 2011-12-2
121234 | 934575 | fgdf | 12345 | sold | 2011-12-2
276345 | 243324 | dfgd | 12345 | sold | 2011-12-2
432642 | 567647 | ghmj | 12345 | sold | 2011-12-2
Please help. Thanks in advance.
1 Answer