Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

SQL Crosstab, a hell of a DBI idiom

by gmax (Abbot)
on Dec 11, 2003 at 00:34 UTC ( #313934=perlmeditation: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl -w
    use strict;
    ...
           . "GROUP BY country, loc\n";
    
    print $query;
    
  2. or download this
    my $depts = $dbh->selectcol_arrayref(qq{SELECT DISTINCT dept FROM dept
    +s})
        or die "can't get dept values\n";
    ...
        or die "can't get gender values\n";
    
    my @values = ( $depts, $categories, $genders );
    
  3. or download this
    $query = qq{
    SELECT country, loc
    ...
        INNER JOIN countries ON(locs.country_id=countries.country_id)
    GROUP BY country, loc
    }
    
  4. or download this
     @permuted = (
       ['pers',  'consultant', 'm'],
    ...
       ['sales', 'employee'],
       ['sales'],
    );
    
  5. or download this
    $header_formats = [
      [
    ...
        { name => 'total',      colspan => 1, rowspan => 1 }
      ]
    ];
    
  6. or download this
    # $level =0; $value = 'N';
    print '<td rowspan= "',
        shift @{$recs_formats->{$level}->{$value}},
        '">', $value,'</td>';
    
  7. or download this
    $recs_formats = {
        0 => {
    ...
            'zzzz'      => [ 1, 1, 1, 1, 1, 1 ],
      }
    };
    
  8. or download this
    
    -- xtab              { colspan => 22 }
    ...
           +- zzzz       { rowspan =>  1 }
               +- zzzz   { rowspan =>  1 }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://313934]
Approved by rob_au
Front-paged by Plankton
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (14)
As of 2015-07-30 23:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (273 votes), past polls