Try changing the query to:

SELECT Count(tblUsers.status) AS num, username
  FROM tblUsers
  GROUP BY tblUsers.username

u can group by the fields in the select list. Status is not in the select
list (only username is).

Vijaylakshmi S
Senior Software Engineer
IT Solutions (I) Pvt. Ltd.,
Chennai



                    "Liu, Leo Huaizhen"
                    <Leo.Liu@COMMERCEONE.        To:     [EMAIL PROTECTED]
                    COM>                         cc:
                    Sent by: "A mailing          Subject:     Data Type of 
'Count(tblUser.status) AS num'?
                    list for discussion
                    about Sun
                    Microsystem's Java
                    Servlet API
                    Technology."
                    <SERVLET-INTEREST@jav
                    a.sun.com>


                    01/02/01 12:32 PM
                    Please respond to "A
                    mailing list for
                    discussion about Sun
                    Microsystem's Java
                    Servlet API
                    Technology."





Please help me out.

I have query (SQL Server7.0)
  SELECT Count(tblUsers.status) AS num, username
  FROM tblUsers
  GROUP BY tblUsers.username,tblUsers.status

However, the ResultSet.getInt("num") gave me error:
        javax.servlet.ServletException: [Microsoft][ODBC SQL Server
Driver]Invalid Descriptor Index
        java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Invalid
Descriptor Index

I don't know what data type of 'num' should be, and how to fix this error.
Please help.
Thanks,

Leo.


.....
while (rs1.next())
{
  out.println(rs1.getString("username"));                       //this is
ok...
  out.println(String.valueOf(rs1.getInt("num"))         //error here....
}

....

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to