Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
...code sql connect... my $year = param('year') || ''; # for testing only my $sql = "select name from mytable where acc = '12345' and ( (year='$year') or (year = $year + 1) )"; my $res= $dbh->exec_select( $sql ); ...code
...code my $year = param('year') || ''; # for testing only my $sql = "select name ,case year when '$year' then '$year' else '$year + 1' end from mytable where acc = '12345' and ( (year='$year') or (year = $year + 1) )"; ...code
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: SQl logic inPerl
by Corion (Patriarch) on Jul 14, 2010 at 17:46 UTC | |
by Anonymous Monk on Jul 14, 2010 at 18:24 UTC | |
by Corion (Patriarch) on Jul 14, 2010 at 18:29 UTC | |
by Anonymous Monk on Jul 14, 2010 at 19:49 UTC | |
by Corion (Patriarch) on Jul 14, 2010 at 19:53 UTC | |
|
Re: SQl logic inPerl
by brap (Pilgrim) on Jul 14, 2010 at 18:42 UTC |