From: Hassan Schroeder Date: 2012-09-25T01:07:09+09:00 Subject: Re: Ruby SQL Select Sum 2 Columns? On Mon, Sep 24, 2012 at 9:00 AM, Courtney Fay wrote: > I have looked all over for this issue, and there is so little > documentation that no matter how I search, I can't find any examples of > what I want to do. It seems this should be simple enough, but no one > can seem to help. Your example: connection = java.sql.DriverManager.getConnection(db_url, user_name, password) sqlsame = "SELECT sum(myfield) AS sumDoc FROM " + table_var statement = connection.prepareStatement(sqlsame) rows = statement.execute_query 'rows' now contains the results of your query. Do you know what it is? Hint: in irb, run the above and then try rows.class to find out what kind of object it is. Then go read the doc for that object. -- Hassan Schroeder ------------------------ hassan.schroeder@gmail.com http://about.me/hassanschroeder twitter: @hassan