Sorry. Its my mistake to not saying for you clearly. Here if I am using join & map its returning all the sum of the columns. but I have percentages in the middle. The percentages also adding and its returning like "590.04%". After seeing this result I changed my program to

my $sql = "select sum(Total_MO),sum(Total_MO_sucess),sum(MO_userdep_er +ror),sum(MO_subcrib_error),sum(MO_system_error),sum(Total_MO_success_ +rate)/(select count(Total_MO_success_rate) from CDR where Date = '13- +10-2015' and Hour like '00:%'),sum(Total_AO),sum(Total_AO_sucess),sum +(AO_userdep_error),sum(AO_subcrib_error),sum(AO_system_error),sum(Tot +al_AO_success_rate)/(select count(Total_AO_success_rate) from CDR whe +re Date = '13-10-2015' and Hour like '00:%'),sum(Total_MT_P2P),sum(To +tal_MT_sucess_P2P),sum(MT_P2P_userdep_error),sum(MT_P2P_subcrib_error +),sum(MT_P2P_system_error),sum(Total_MT_P2P_success_rate)/(select cou +nt(Total_AO_success_rate) from CDR where Date = '13-10-2015' and Hour + like '00:%'),sum(Total_MT_A2P),sum(Total_MT_sucess_A2P),sum(MT_A2P_u +serdep_error),sum(MT_A2P_subcrib_error),sum(MT_A2P_system_error),sum( +Total_MT_A2P_success_rate)/(select count(Total_AO_success_rate) from +CDR where Date = '13-10-2015' and Hour like '00:%'),sum(Total_AT),sum +(Total_AT_sucess),sum(AT_ESMEdep_error),sum(AT_network_error),sum(AT_ +system_error),sum(Total_AT_success_rate)/(select count(Total_AO_succe +ss_rate) from CDR where Date = '13-10-2015' and Hour like '00:%'),sum +(P2P_FDA_count),sum(P2P_FDA_success_count),sum(P2P_FDA_success_rate)/ +(select count(Total_AO_success_rate) from CDR where Date = '13-10-201 +5' and Hour like '00:%'),sum(A2P_FDA_count),sum(A2P_FDA_success_count +),sum(A2P_FDA_success_rate)/(select count(Total_AO_success_rate) from + CDR where Date = '13-10-2015' and Hour like '00:%'),sum(Total_Count) +,sum(Total_TPS),max(Greatest_TPS) from CDR where Date = ? and Hour li +ke ?"; foreach my $hour ("00","01","02","03","04","05","06","07","08","09",10 +..23) { $sth->execute($date, "$hour:%") or die $DBI::errstr; my @my_array = (); push(@my_array,$hour); push(@my_array,$sth->fetchrow_array()); my $col = 0; print @my_array,$/; foreach my $value (@my_array) { $sheet->AddCell( $row, $col, $value ); ++$col; } $row++; }

Its too ugly I know. But have a look. Here I have Percentages & the last column is Greatest tps. To achieve this

sum(A2P_FDA_success_rate)/(select count(Total_AO_success_rate) from CD +R where Date = '13-10-2015' and Hour like '00:%') max(Greatest_TPS)

I need to write like this. Now show me a shortcut please.


In reply to Re^10: using system command in regex by ravi45722
in thread using system command in regex by ravi45722

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.