Changeset 433


Ignore:
Timestamp:
Jan 8, 2007, 6:41:45 PM (13 years ago)
Author:
Nick Burch
Message:

Calculate the outer + 1st inner stats too

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/npemap.org.uk/perllib/NPEMap/Postcodes.pm

    r353 r433  
    2222       SUM(CASE WHEN source = 0 THEN 1 ELSE 0 END) AS us,
    2323       COUNT(DISTINCT outward) AS all_out,
    24        COUNT(DISTINCT CASE WHEN source = 0 THEN outward ELSE '' END) - 1 AS us_out
     24       COUNT(DISTINCT CASE WHEN source = 0 THEN outward ELSE '' END) - 1 AS us_out,
     25       COUNT(DISTINCT CASE WHEN char_length(inward) > 0 THEN
     26                outward || ' ' || substr(inward,1,1)
     27             ELSE '' END) - 1 AS all_out1,
     28       COUNT(DISTINCT CASE WHEN char_length(inward) > 0 THEN
     29                                CASE WHEN source = 0 THEN
     30                        outward || ' ' || substr(inward,1,1)
     31                                ELSE '' END
     32             ELSE '' END) - 1 AS us_out1
    2533FROM postcodes WHERE deleted = 'f';
    2634HERE
Note: See TracChangeset for help on using the changeset viewer.