• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

using count(*)

 
siva kumar
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the follwing statements are not working

rs=stmt.executeQuery("select count(*) as ct from cinema_master1 x,movie_master1 y,show_master1 z where y.movie_id=z.movie_id and x.cinema_id=y.cinema_id");

int id=rs.getInt("ct");
System.out.println(id);
 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
balasubramanian,

the follwing statements are not working

Does this mean
  • You are getting an error message?
  • You are not getting the expected result(s)?
  • None of the above.


  • For your information, a query similar to yours (select "count(*)" from several, different database tables) works for me using an Oracle 9i (9.2.0.4) database.

    Good Luck,
    Avi.
     
    Adeel Ansari
    Ranch Hand
    Posts: 2874
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    saying not working is something incomplete you should metion wht are you gettin as a result.

    anyway, try this

    int id = rs.getInt(1);
     
    Bear Bibeault
    Author and ninkuma
    Marshal
    Pie
    Posts: 65335
    97
    IntelliJ IDE Java jQuery Mac Mac OS X
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    "balasubramanian",

    We're pleased to have you here with us on the Ranch, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

    In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

    Thanks!
    bear
    Forum Bartender
     
    Ganesh Pujar
    Ranch Hand
    Posts: 45
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    use rs.next() first and then rs.getInt()
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic