my dog learned polymorphism
The moose likes JDBC and Relational Databases and the fly likes Regarding PreparedStatement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Regarding PreparedStatement" Watch "Regarding PreparedStatement" New topic

Regarding PreparedStatement

adeeb alexander
Ranch Hand

Joined: May 29, 2008
Posts: 268
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

Joined: May 26, 2003
Posts: 33124

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

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
I agree. Here's the link:
subject: Regarding PreparedStatement
It's not a secret anymore!