Basic report generating question.
I have a dataset that I would like to sort, group, and print all fancy like. The kind of basic report one could generate with MS Access.
Field names are:
Name - Name of person who owns record
Sname - First Last Name
Address - 1313 Mocking Bird Lane
City -...
No it does not execute the die command. It simply returns a 1, but does not update the table.
So that being said, If I do the following:
select count(*), filler1
from table
where filler1=""
group by filler1
How would I go about testing the results? If the resulting count is 0, then I can...
It is important to evenly distribute the recors. I would love to have the ability to stack the rows specifically by zip code. Plus its a very interesting problem that I would love to work out in Perl.
- FL
What I would like to do is iterate through the file sorting on the ZIP field, evenly distributing the records through out the file.
Example if my file contains the following quantities of zip codes.
QTY ZIP
3 98765
2 12345
2 78934
Then my file would be sorted somewhat...
My sanity has been checked. :)
Running the SQL by hand produces the results I am looking for. I have a table with 10 records. When run by hand the records are updated.
I am aware of the reserved word conflict. This is just an example swapping out the table and field names.
One thing I did...
I pulled the same info from the CPAN docs. I thought I might have done something wrong since the only output I get is a 1.
When I do
print "$rows_affected\n";
I get a 1
FL
Quick question on DBI.
Using the following example code.
my $sql = qq{ UPDATE table set field1 = "A"
WHERE field2 = "" };
$dbh->do( $sql );
What would I need to do to return the total number of records that were changed?
Thank you.
FL
This is what I ended up with. It works like a champ.
my $total;
for my $key (keys %info) {
if (($info{$key}{I}) && ($info{$key}{O})) {
$total = $info{$key}{I} + $info{$key}{O};
} elsif ((!$info{$key}{I}) and ($info{$key}{O})) {
$total = $info{$key}{O};
} elsif...
I was looking for a solution to this error at run time:
Use of uninitialized value in addition (+) at ./sql.pl line 111.
Line 111 is:
my $total = $info{$key}{I} + $info{$key}{O};
My thinking was since there are records where there is no data for example $info{$key}{I} then the string was...
It appears that comparing them assignments to 0 does not work. I beleive perl is having a problem with it because if there is no data for $info{$key}{I} or $info{$key}{O} then the strings are never created. So we are trying to evaluate a string that does not exist.
if (($info{$key}{I}) &&...
I was able to use the following to make sure that the hash contains the correct information:
for my $keys ( keys %info ) {
print "$keys: ";
for my $value ( keys %{ $info{$keys} } ) {
print "$value=$info{$keys}{$value} ";
}
print "\n";
}
But one problem became...
Just re-reading your post you also mentioned a hash of hashes. I have done a little reading with the help of google and I have to say I am completely confused now. I understand the concept but can't seem to find any examples that actually explain what is happening. Just code snippets.
That is exactly it KevinADC. I am at a complete loss as to how to proceed once I have the data all in one place. If you can help direct me on how to read the data from the database so that I can produce the numbers I need that will be fantastic.
FL
Here is what I have.
#!/usr/bin/perl -w
use strict;
use Date::Calc qw(Days_in_Month System_Clock Add_Delta_YM);
my ($year,$month,$day, $hour,$min,$sec, $doy,$dow,$dst) = System_Clock();
my ($ReportYear,$ReportMonth,$ReportDay) = Add_Delta_YM($year,$month,$day, 0, -1);
my $ReportY2D = substr...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.