MySQL Forums
Forum List  »  Perl

Count the Column values if it same in the column
Posted by: kalaivani mani
Date: May 26, 2007 11:07PM

Hai,

I have a table like,

+-------+----------+-----------+-------------+----------+---------+---------+-----------+--------+----------+
| PdbId | MetalAtm | MetalName | MetalNumber | MetalChn | AtmName | ResName | ResNumber | ResChn | Distance |
+-------+----------+-----------+-------------+----------+---------+---------+-----------+--------+----------+
| 1nc7 | MG | MG | 1501 | - | CL | CL | 1401 | - | 3.065 |
| 1nc7 | MG | MG | 1501 | - | CL | CL | 1402 | - | 2.660 |
| 1pex | CA | CA | 503 | - | CL | CL | 501 | - | 2.895 |
| 1qhu | NA | NA | 3 | - | CL | CL | 1 | - | 3.096 |
| 1qjs | NA | NA | 513 | A | CL | CL | 511 | A | 3.096 |
| 1rtg | CA | CA | 2 | - | CL | CL | 1 | - | 3.079 |
| 1xj6 | NA | NA | 5002 | - | CL | CL | 5001 | - | 2.628 |
| 2caj | NI | NI | 1151 | B | CL | CL | 1150 | B | 3.551 |
| 2oa9 | CD | CD | 911 | - | CL | CL | 800 | - | 2.291 |
| 2oa9 | CD | CD | 913 | - | CL | CL | 801 | - | 2.403 |
+-------+----------+-----------+-------------+----------+---------+---------+-----------+--------+----------+

I want to retrieve the rows only the count must have of single PdbId with RESNAME=CL should >=2
that means i want to retreive only
+-------+----------+-----------+-------------+----------+---------+---------+-----------+--------+----------+
| PdbId | MetalAtm | MetalName | MetalNumber | MetalChn | AtmName | ResName | ResNumber | ResChn | Distance |
+-------+----------+-----------+-------------+----------+---------+---------+-----------+--------+----------+
| 1nc7 | MG | MG | 1501 | - | CL | CL | 1401 | - | 3.065 |
| 1nc7 | MG | MG | 1501 | - | CL | CL | 1402 | - | 2.660 |
| 2oa9 | CD | CD | 911 | - | CL | CL | 800 | - | 2.291 |
| 2oa9 | CD | CD | 913 | - | CL | CL | 801 | - | 2.403 |
+-------+----------+-----------+-------------+----------+---------+---------+-----------+--------+----------+

thanks in advance

Options: ReplyQuote


Subject
Written By
Posted
Count the Column values if it same in the column
May 26, 2007 11:07PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.