my dog learned polymorphism*
The moose likes JDBC and the fly likes Regarding PreparedStatement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Regarding PreparedStatement" Watch "Regarding PreparedStatement" New topic
Author

Regarding PreparedStatement

adeeb alexander
Ranch Hand

Joined: May 29, 2008
Posts: 268
Hi,
I know that to get the row count from sql we should give as follows
select count(*) from tablename where columnName = value;
is this wright
Now my problem is, actually i am adding students data in the table from text fields. But what i need is the maximum row count for each roll number should be 3. There should not be repeated rows more than three times. Please tell me how can i achieve this.
Thanks and Regards
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30789
    
157

Adeeb,
Take a look at the having/group by clauses. They allow you to do the query on different sets of data.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
Consider Paul's rocket mass heater.
 
subject: Regarding PreparedStatement