| Author |
JDBC
|
manikandan malathy
Greenhorn
Joined: Sep 17, 2008
Posts: 13
|
|
I have one problem in my program... In my table contain 50 records... I am using mysql database. How to getting every 5th record in my table give any sample code....
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32692
|
|
Please use a subject which tells what the post is about. I think this is more appopriate for another forum, so I shall move you.
|
 |
Paul Campbell
Ranch Hand
Joined: Oct 06, 2007
Posts: 338
|
|
You have to rank the rows and use modulus to skip rows... something like this: In Oracle and DB2 you you have can use the built-in functions to do it in a little cleaner way... something like this:
|
 |
manikandan malathy
Greenhorn
Joined: Sep 17, 2008
Posts: 13
|
|
i am executing this query some error will occur.... Error Msg in MySQL: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '*) from sample b where b.emp_no <= a.emp_no) as rn from sample a) z where mod ' at line 1
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32692
|
|
|
MySQL error messages are hardly informative. If you want us to help, please quote the entire SQL statement which produces that error. It may be something tiny like a spelling error.
|
 |
 |
|
|
subject: JDBC
|
|
|