blackadder has asked for the wisdom of the Perl Monks concerning the following question:
I need total sum of the sizes of all entries (i.e the total sum of the “Size_Byte” Column). So I wrote this bit of Code;File_name, Size_Byte, Date Mydoc.doc, 1234, 11/12/2005 My.xls,2753,11/05/2004 fgf.pdf,90765,01/07/2001 the sheep and cucumber.mdb,4567356,01/01/2003 jojo-elliot.ppt,45675465,08/12/1995 hello_doly,8672341,12/9/1966
my sql statement seems to be ok (no errors), but what I don’t know how to do is to print out the returned value! i.e the total sum of the values in the Size column.#! c:/perl/bin/perl.exe -slw use strict; use Win32::ODBC; my $DSN = 'DD1'; my $DB = new Win32::ODBC($DSN) || die "Error => $DSN $!\n"; my $total = $DB->sql("SELECT SUM(Size_Byte) FROM Files_U WHERE Type =' +doc'"); #print "$total"; this is not correct $DB->Close;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: SQL to obtain total SUM of a column and all entries between 2 dates
by davidrw (Prior) on Jul 20, 2005 at 17:52 UTC |