Dear All,

I have a table ( called Files_U ) like so, and I have 2 questions
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
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;
#! 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;
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.

My other question is; how can I create an sql statement that returns all the values in between two different dates?

Can I rely on your help and guidance in this please and maybe a quick example?

Thanks
Blackadder

In reply to SQL to obtain total SUM of a column and all entries between 2 dates by blackadder

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.