in reply to Re^5: using system command in regex
in thread using system command in regex
What an Idea pragrammatic.... Nearly from three days struggling with this. Finally I solved it. Working great. Thank you very much. And I want to ask you one more thing. As already told I have three (Postpaid, Prepaid, Delivery) files for every 10 minutes. After calculating I am uploading all the values into DB like this.
Date Hour Mo_resp MT_resp AO_resp Percentage 10-08-2015 00:00 256 382 36 87% 10-08-2015 00:10 491 438 12 92%
(Its a sample. Actually my DB contains 38 columns) Like this I am uploading all values for every 10 minutes. Now my requirement is to add all MO_resp all AO_resp ... and son on (all columns) which occurred in 00 hour to write an hourly report in excel sheet. For that I am Doing
use DBI; my $hour_db = DBI->connect("DBI:mysql:database=$db;host=$host;mysql_so +cket=/opt/lampstack-5.5.27-0/mysql/tmp/mysql.sock","root","", {'Raise +Error' => 1}); my @column_names = ("MO_resp","MT_resp","AO_resp"); foreach my $column_name (@column_names) { my $hour_sth = $hour_db->prepare("Select sum($column_name) from $t +able_name where Date='$db_date' and Hour like='$hour:%'"); $hour_sth->execute() or die $DBI::errstr; ..... }
#Like this I am reading each column sum one by one. But I feel this is not a good method. Can you show me a way???
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: using system command in regex
by marto (Cardinal) on Oct 15, 2015 at 10:47 UTC | |
|
Re^7: using system command in regex
by shmem (Chancellor) on Oct 15, 2015 at 12:24 UTC | |
by ravi45722 (Pilgrim) on Oct 16, 2015 at 03:59 UTC | |
by shmem (Chancellor) on Oct 16, 2015 at 07:27 UTC | |
by ravi45722 (Pilgrim) on Oct 16, 2015 at 09:50 UTC | |
|
Re^7: using system command in regex
by soonix (Chancellor) on Oct 15, 2015 at 14:48 UTC | |
by shmem (Chancellor) on Oct 15, 2015 at 15:33 UTC | |
by soonix (Chancellor) on Oct 15, 2015 at 19:28 UTC |