[thelist] MYSQL - Joining multiple rows and adding a columns values
jason h
jayuk_1 at hotmail.com
Mon Jan 8 12:53:56 CST 2007
Thanks a lot for the replies :)
String selectSQL = "SELECT recording_id, sum(quantity) "+
"FROM requests " +
"GROUP BY recording_id";
Statement stmt = conn.createStatement();
ResultSet rs1 = stmt.executeQuery(selectSQL);
...
while (rs1.next())
{
out.println("<TR>" +
"<TD>" + rs1.getInt("recording_id") +
"</TD>" +
"<TD>" + rs1.getInt("sum(quantity)") +
"</TD>");
}
I didn't have to create an extra table to store the values either which was
a bonus. Problem solved!
_________________________________________________________________
MSN Hotmail is evolving check out the new Windows Live Mail
http://ideas.live.com
More information about the thelist
mailing list