diff options
author | ivan <ivan> | 2008-08-19 10:06:45 +0000 |
---|---|---|
committer | ivan <ivan> | 2008-08-19 10:06:45 +0000 |
commit | c3054513f27015595ce512dcb28748fb9ee11e27 (patch) | |
tree | 4119989086933a69abb131b184f6691d8d501cef /httemplate/browse/rate_region.html | |
parent | 233ef9c25931dd63e690b402dcbeb1df275e540d (diff) |
more consistent prefix display, and don't forget nxx'
Diffstat (limited to 'httemplate/browse/rate_region.html')
-rw-r--r-- | httemplate/browse/rate_region.html | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/httemplate/browse/rate_region.html b/httemplate/browse/rate_region.html index e144625a5..df3d2f0b8 100644 --- a/httemplate/browse/rate_region.html +++ b/httemplate/browse/rate_region.html @@ -33,8 +33,13 @@ my $extra_sql = ''; if ( driver_name =~ /^Pg/ ) { my $fromwhere = 'FROM rate_prefix'. ' WHERE rate_prefix.regionnum = rate_region.regionnum'; + my $prefix_sql = " CASE WHEN nxx IS NULL OR nxx = '' ". + " THEN npa ". + " ELSE npa || '-' || nxx ". + " END"; + my $prefixes_sql = "SELECT $prefix_sql $fromwhere AND npa IS NOT NULL"; $select .= "( SELECT countrycode $fromwhere LIMIT 1 ) AS ccode, - ARRAY_TO_STRING( ARRAY(SELECT npa $fromwhere AND npa IS NOT NULL), ',' ) AS prefixes"; + ARRAY_TO_STRING( ARRAY($prefixes_sql), ',' ) AS prefixes"; } elsif ( driver_name =~ /^mysql/i ) { $join = 'LEFT JOIN rate_prefix USING ( regionnum )'; $select .= "GROUP_CONCAT( DISTINCT countrycode ) AS ccode, |