mysql> select count(*) as PAID_DELETES, 'SC' as STATE, sum(case when gender=1 then 1 else 0 end) as FEMALE, sum(case when gender=2 then 1 else 0 end) as MALE, sum(case when dob < '1950-06-30' then 1 else 0 end) as AGE_OVER_65, sum(case when dob between '1960-07-01' and '1970-06-30' then 1 else 0 end) as AGE_55_65, sum(case when dob between '1960-07-01' and '1970-06-30' then 1 else 0 end) as AGE_45_55, sum(case when dob between '1970-07-01' and '1980-06-30' then 1 else 0 end) as AGE_35_45, sum(case when dob between '1980-07-01' and '1990-06-30' then 1 else 0 end) as AGE_25_35, sum(case when dob > '1990-06-30' then 1 else 0 end) as AGE_UNDER_25 from sc_am_am_member where first_name=''; +--------------+-------+--------+------+-------------+-----------+-----------+-----------+-----------+--------------+ | PAID_DELETES | STATE | FEMALE | MALE | AGE_OVER_65 | AGE_55_65 | AGE_45_55 | AGE_35_45 | AGE_25_35 | AGE_UNDER_25 | +--------------+-------+--------+------+-------------+-----------+-----------+-----------+-----------+--------------+ | 1311 | SC | 98 | 1213 | 36 | 385 | 385 | 428 | 264 | 18 | +--------------+-------+--------+------+-------------+-----------+-----------+-----------+-----------+--------------+ mysql> select count(*) as PAID_DELETES, 'SC' as STATE, sum(case when gender=1 then 1 else 0 end) as FEMALE, sum(case when gender=2 then 1 else 0 end) as MALE, sum(case when dob < '1950-06-30' then 1 else 0 end) as AGE_OVER_65, sum(case when dob between '1960-07-01' and '1970-06-30' then 1 else 0 end) as AGE_55_65, sum(case when dob between '1960-07-01' and '1970-06-30' then 1 else 0 end) as AGE_45_55, sum(case when dob between '1970-07-01' and '1980-06-30' then 1 else 0 end) as AGE_35_45, sum(case when dob between '1980-07-01' and '1990-06-30' then 1 else 0 end) as AGE_25_35, sum(case when dob > '1990-06-30' then 1 else 0 end) as AGE_UNDER_25 from sc_am_am_member where first_name='' and gender=1; +--------------+-------+--------+------+-------------+-----------+-----------+-----------+-----------+--------------+ | PAID_DELETES | STATE | FEMALE | MALE | AGE_OVER_65 | AGE_55_65 | AGE_45_55 | AGE_35_45 | AGE_25_35 | AGE_UNDER_25 | +--------------+-------+--------+------+-------------+-----------+-----------+-----------+-----------+--------------+ | 98 | SC | 98 | 0 | 1 | 34 | 34 | 34 | 22 | 0 | +--------------+-------+--------+------+-------------+-----------+-----------+-----------+-----------+--------------+ mysql> select count(*) as PAID_DELETES, 'USA' as COUNTRY, sum(case when gender=1 then 1 else 0 end) as FEMALE, sum(case when gender=2 then 1 else 0 end) as MALE, sum(case when dob < '1950-06-30' then 1 else 0 end) as AGE_OVER_65, sum(case when dob between '1960-07-01' and '1970-06-30' then 1 else 0 end) as AGE_55_65, sum(case when dob between '1960-07-01' and '1970-06-30' then 1 else 0 end) as AGE_45_55, sum(case when dob between '1970-07-01' and '1980-06-30' then 1 else 0 end) as AGE_35_45, sum(case when dob between '1980-07-01' and '1990-06-30' then 1 else 0 end) as AGE_25_35, sum(case when dob > '1990-06-30' then 1 else 0 end) as AGE_UNDER_25 from us_am_am_member where first_name=''; +--------------+---------+--------+--------+-------------+-----------+-----------+-----------+-----------+--------------+ | PAID_DELETES | COUNTRY | FEMALE | MALE | AGE_OVER_65 | AGE_55_65 | AGE_45_55 | AGE_35_45 | AGE_25_35 | AGE_UNDER_25 | +--------------+---------+--------+--------+-------------+-----------+-----------+-----------+-----------+--------------+ | 115507 | USA | 8701 | 106806 | 2894 | 34075 | 34075 | 38409 | 24060 | 1811 | +--------------+---------+--------+--------+-------------+-----------+-----------+-----------+-----------+--------------+ mysql> select count(*) as PAID_DELETES, 'USA' as COUNTRY, sum(case when gender=1 then 1 else 0 end) as FEMALE, sum(case when gender=2 then 1 else 0 end) as MALE, sum(case when dob < '1950-06-30' then 1 else 0 end) as AGE_OVER_65, sum(case when dob between '1960-07-01' and '1970-06-30' then 1 else 0 end) as AGE_55_65, sum(case when dob between '1960-07-01' and '1970-06-30' then 1 else 0 end) as AGE_45_55, sum(case when dob between '1970-07-01' and '1980-06-30' then 1 else 0 end) as AGE_35_45, sum(case when dob between '1980-07-01' and '1990-06-30' then 1 else 0 end) as AGE_25_35, sum(case when dob > '1990-06-30' then 1 else 0 end) as AGE_UNDER_25 from us_am_am_member where first_name='' and gender=1; +--------------+---------+--------+------+-------------+-----------+-----------+-----------+-----------+--------------+ | PAID_DELETES | COUNTRY | FEMALE | MALE | AGE_OVER_65 | AGE_55_65 | AGE_45_55 | AGE_35_45 | AGE_25_35 | AGE_UNDER_25 | +--------------+---------+--------+------+-------------+-----------+-----------+-----------+-----------+--------------+ | 8701 | USA | 8701 | 0 | 110 | 3101 | 3101 | 3311 | 1314 | 152 | +--------------+---------+--------+------+-------------+-----------+-----------+-----------+-----------+--------------+ mysql> select count(*) as PAID_DELETES, concat(city,",",state) as CITYSTATE, sum(case when gender=1 then 1 else 0 end) as FEMALE, sum(case when gender=2 then 1 else 0 end) as MALE, sum(case when dob < '1950-06-30' then 1 else 0 end) as AGE_OVER_65, sum(case when dob between '1960-07-01' and '1970-06-30' then 1 else 0 end) as AGE_55_65, sum(case when dob between '1960-07-01' and '1970-06-30' then 1 else 0 end) as AGE_45_55, sum(case when dob between '1970-07-01' and '1980-06-30' then 1 else 0 end) as AGE_35_45, sum(case when dob between '1980-07-01' and '1990-06-30' then 1 else 0 end) as AGE_25_35, sum(case when dob > '1990-06-30' then 1 else 0 end) as AGE_UNDER_25 from us_am_am_member where first_name='' group by CITYSTATE order by FEMALE desc limit 100; +--------------+---------------------+--------+------+-------------+-----------+-----------+-----------+-----------+--------------+ | PAID_DELETES | CITYSTATE | FEMALE | MALE | AGE_OVER_65 | AGE_55_65 | AGE_45_55 | AGE_35_45 | AGE_25_35 | AGE_UNDER_25 | +--------------+---------------------+--------+------+-------------+-----------+-----------+-----------+-----------+--------------+ | 2498 | New York,33 | 231 | 2267 | 48 | 594 | 594 | 980 | 627 | 32 | | 1591 | Houston,45 | 113 | 1478 | 40 | 463 | 463 | 541 | 355 | 22 | | 1450 | Chicago,14 | 108 | 1342 | 12 | 359 | 359 | 557 | 377 | 16 | | 797 | Dallas,45 | 92 | 705 | 17 | 239 | 239 | 288 | 161 | 5 | | 1062 | Los Angeles,5 | 91 | 971 | 12 | 254 | 254 | 451 | 267 | 10 | | 886 | Atlanta,11 | 88 | 798 | 10 | 287 | 287 | 348 | 160 | 8 | | 815 | Austin,45 | 67 | 748 | 19 | 233 | 233 | 306 | 165 | 8 | | 748 | Washington,9 | 62 | 686 | 6 | 208 | 208 | 261 | 213 | 12 | | 686 | san antonio,45 | 60 | 626 | 14 | 178 | 178 | 241 | 173 | 18 | | 749 | Denver,6 | 58 | 691 | 15 | 228 | 228 | 284 | 161 | 6 | | 620 | Philadelphia,39 | 57 | 563 | 4 | 130 | 130 | 238 | 195 | 10 | | 648 | Boston,22 | 54 | 594 | 4 | 177 | 177 | 241 | 169 | 9 | | 643 | San Francisco,5 | 51 | 592 | 16 | 157 | 157 | 263 | 143 | 5 | | 788 | san diego,5 | 50 | 738 | 22 | 198 | 198 | 245 | 229 | 17 | | 653 | Brooklyn,33 | 50 | 603 | 7 | 114 | 114 | 281 | 203 | 8 | | 564 | Miami,10 | 45 | 519 | 9 | 130 | 130 | 202 | 154 | 12 | | 687 | Seattle,50 | 43 | 644 | 15 | 203 | 203 | 272 | 126 | 9 | | 470 | Portland,38 | 41 | 429 | 18 | 119 | 119 | 173 | 91 | 7 | | 708 | Minneapolis,24 | 40 | 668 | 13 | 211 | 211 | 255 | 156 | 8 | | 439 | Las Vegas,29 | 40 | 399 | 17 | 121 | 121 | 138 | 97 | 5 | | 422 | Salt Lake City,46 | 39 | 383 | 8 | 97 | 97 | 141 | 131 | 4 | | 681 | Charlotte,34 | 37 | 644 | 6 | 211 | 211 | 292 | 111 | 2 | | 368 | San Jose,5 | 36 | 332 | 9 | 128 | 128 | 128 | 57 | 3 | | 495 | Phoenix,3 | 35 | 460 | 17 | 154 | 154 | 161 | 94 | 5 | | 427 | Indianapolis,15 | 35 | 392 | 13 | 119 | 119 | 137 | 98 | 4 | | 364 | Orlando,10 | 34 | 330 | 3 | 127 | 127 | 131 | 63 | 5 | | 391 | Fort Lauderdale,10 | 34 | 357 | 8 | 144 | 144 | 126 | 67 | 6 | | 308 | Birmingham,1 | 32 | 276 | 5 | 109 | 109 | 107 | 47 | 1 | | 423 | Tampa,10 | 31 | 392 | 4 | 121 | 121 | 157 | 91 | 7 | | 246 | plano,45 | 29 | 217 | 3 | 93 | 93 | 89 | 27 | 1 | | 372 | Raleigh,34 | 29 | 343 | 10 | 115 | 115 | 116 | 68 | 8 | | 362 | Arlington,49 | 27 | 335 | 7 | 89 | 89 | 132 | 109 | 3 | | 464 | Pittsburgh,39 | 26 | 438 | 9 | 129 | 129 | 168 | 112 | 5 | | 376 | Fort Worth,45 | 26 | 350 | 11 | 95 | 95 | 118 | 94 | 7 | | 261 | Alpharetta,11 | 25 | 236 | 3 | 113 | 113 | 84 | 28 | 0 | | 318 | Colorado Springs,6 | 25 | 293 | 11 | 102 | 102 | 108 | 62 | 3 | | 399 | columbus,36 | 25 | 374 | 5 | 108 | 108 | 148 | 101 | 6 | | 301 | Sacramento,5 | 24 | 277 | 3 | 85 | 85 | 101 | 71 | 5 | | 195 | beverly hills,5 | 23 | 172 | 9 | 44 | 44 | 70 | 41 | 9 | | 286 | Kansas City,26 | 23 | 263 | 7 | 67 | 67 | 121 | 62 | 1 | | 168 | Hollywood,10 | 23 | 145 | 3 | 47 | 47 | 73 | 31 | 0 | | 328 | Cleveland,36 | 23 | 305 | 5 | 108 | 108 | 107 | 66 | 3 | | 345 | Louisville,18 | 22 | 323 | 6 | 96 | 96 | 130 | 66 | 2 | | 376 | Scottsdale,3 | 22 | 354 | 12 | 157 | 157 | 107 | 36 | 4 | | 444 | Cincinnati,36 | 21 | 423 | 8 | 119 | 119 | 155 | 99 | 8 | | 261 | Baltimore,21 | 21 | 240 | 6 | 73 | 73 | 91 | 63 | 3 | | 389 | Saint Louis,26 | 20 | 369 | 10 | 114 | 114 | 127 | 89 | 5 | | 365 | Nashville,44 | 20 | 345 | 8 | 104 | 104 | 139 | 78 | 2 | | 352 | oklahoma city,37 | 20 | 332 | 11 | 90 | 90 | 107 | 86 | 9 | | 85 | Kingwood,45 | 20 | 65 | 0 | 45 | 45 | 22 | 7 | 3 | | 351 | Alexandria,49 | 20 | 331 | 8 | 92 | 92 | 127 | 78 | 5 | | 146 | Arlington,45 | 19 | 127 | 4 | 44 | 44 | 36 | 39 | 3 | | 309 | Tucson,3 | 19 | 290 | 8 | 85 | 85 | 98 | 55 | 8 | | 392 | Saint Paul,24 | 19 | 373 | 6 | 108 | 108 | 125 | 92 | 9 | | 289 | Milwaukee,52 | 19 | 270 | 6 | 74 | 74 | 105 | 82 | 1 | | 208 | Knoxville,44 | 19 | 189 | 5 | 57 | 57 | 75 | 41 | 1 | | 179 | Grand Rapids,23 | 19 | 160 | 2 | 46 | 46 | 54 | 44 | 0 | | 147 | Long Beach,5 | 18 | 129 | 2 | 42 | 42 | 46 | 40 | 2 | | 141 | Saint Petersburg,10 | 18 | 123 | 2 | 43 | 43 | 49 | 13 | 3 | | 274 | Albuquerque,32 | 18 | 256 | 11 | 75 | 75 | 77 | 69 | 2 | | 177 | Memphis,44 | 17 | 160 | 6 | 49 | 49 | 71 | 31 | 2 | | 331 | Virginia Beach,49 | 17 | 314 | 7 | 67 | 67 | 106 | 123 | 4 | | 219 | Rochester,33 | 17 | 202 | 1 | 57 | 57 | 74 | 53 | 2 | | 301 | Jacksonville,10 | 17 | 284 | 8 | 89 | 89 | 98 | 62 | 4 | | 98 | Walnut Creek,5 | 16 | 82 | 1 | 35 | 35 | 31 | 12 | 1 | | 159 | Newport Beach,5 | 16 | 143 | 2 | 67 | 67 | 44 | 24 | 0 | | 71 | Santa Rosa,5 | 16 | 55 | 0 | 15 | 15 | 18 | 12 | 3 | | 203 | staten island,33 | 16 | 187 | 1 | 41 | 41 | 72 | 71 | 3 | | 169 | Aurora,6 | 15 | 154 | 7 | 63 | 63 | 47 | 32 | 4 | | 116 | Riverside,5 | 14 | 102 | 4 | 30 | 30 | 38 | 28 | 4 | | 103 | White Plains,33 | 14 | 89 | 3 | 32 | 32 | 36 | 18 | 0 | | 166 | Pompano Beach,10 | 14 | 152 | 5 | 67 | 67 | 54 | 24 | 0 | | 258 | Buffalo,33 | 14 | 244 | 5 | 70 | 70 | 77 | 64 | 5 | | 168 | Frisco,45 | 14 | 154 | 3 | 55 | 55 | 80 | 17 | 1 | | 134 | Bakersfield,5 | 14 | 120 | 2 | 29 | 29 | 43 | 38 | 3 | | 110 | Henderson,29 | 14 | 96 | 8 | 34 | 34 | 33 | 15 | 4 | | 157 | Boca Raton,10 | 14 | 143 | 1 | 43 | 43 | 46 | 29 | 4 | | 127 | Oakland,5 | 14 | 113 | 9 | 37 | 37 | 51 | 19 | 0 | | 259 | Spring,45 | 14 | 245 | 7 | 83 | 83 | 98 | 40 | 1 | | 129 | Columbia,42 | 14 | 115 | 2 | 40 | 40 | 46 | 30 | 0 | | 147 | Reno,29 | 14 | 133 | 9 | 38 | 38 | 52 | 26 | 2 | | 180 | Tacoma,50 | 14 | 166 | 7 | 38 | 38 | 50 | 52 | 10 | | 131 | Stamford,7 | 14 | 117 | 3 | 39 | 39 | 49 | 19 | 0 | | 310 | Omaha,28 | 14 | 296 | 5 | 91 | 91 | 104 | 69 | 7 | | 65 | Conroe,45 | 13 | 52 | 1 | 17 | 17 | 21 | 20 | 2 | | 104 | glendale,3 | 13 | 91 | 3 | 28 | 28 | 30 | 25 | 1 | | 167 | west palm beach,10 | 13 | 154 | 7 | 62 | 62 | 43 | 32 | 5 | | 216 | Marietta,11 | 13 | 203 | 3 | 82 | 82 | 80 | 24 | 2 | | 135 | Pasadena,5 | 13 | 122 | 3 | 37 | 37 | 37 | 20 | 0 | | 250 | Madison,52 | 13 | 237 | 2 | 72 | 72 | 75 | 44 | 5 | | 144 | Ann Arbor,23 | 13 | 131 | 2 | 47 | 47 | 38 | 38 | 6 | | 129 | Englewood,6 | 13 | 116 | 2 | 44 | 44 | 55 | 13 | 1 | | 155 | Chandler,3 | 13 | 142 | 5 | 50 | 50 | 67 | 19 | 1 | | 155 | Lexington,18 | 13 | 142 | 4 | 45 | 45 | 45 | 30 | 4 | | 161 | naperville,14 | 12 | 149 | 1 | 58 | 58 | 67 | 17 | 2 | | 114 | Fresno,5 | 12 | 102 | 3 | 36 | 36 | 33 | 26 | 0 | | 153 | Bronx,33 | 12 | 141 | 0 | 30 | 30 | 69 | 48 | 2 | | 82 | Palo Alto,5 | 12 | 70 | 1 | 31 | 31 | 32 | 14 | 2 | | 115 | Fredericksburg,49 | 12 | 103 | 3 | 28 | 28 | 47 | 22 | 1 | | 67 | Fairfield,7 | 12 | 55 | 2 | 25 | 25 | 19 | 5 | 0 | +--------------+---------------------+--------+------+-------------+-----------+-----------+-----------+-----------+--------------+ 100 rows in set (16.38 sec) mysql> select count(*) as PAID_DELETES, concat(city,",",state) as CITYSTATE, sum(case when gender=1 then 1 else 0 end) as FEMALE, sum(case when gender=2 then 1 else 0 end) as MALE, sum(case when dob < '1950-06-30' then 1 else 0 end) as AGE_OVER_65, sum(case when dob between '1960-07-01' and '1970-06-30' then 1 else 0 end) as AGE_55_65, sum(case when dob between '1960-07-01' and '1970-06-30' then 1 else 0 end) as AGE_45_55, sum(case when dob between '1970-07-01' and '1980-06-30' then 1 else 0 end) as AGE_35_45, sum(case when dob between '1980-07-01' and '1990-06-30' then 1 else 0 end) as AGE_25_35, sum(case when dob > '1990-06-30' then 1 else 0 end) as AGE_UNDER_25 from us_am_am_member where first_name='' and gender=1 group by CITYSTATE order by FEMALE desc limit 100; +--------------+---------------------+--------+------+-------------+-----------+-----------+-----------+-----------+--------------+ | PAID_DELETES | CITYSTATE | FEMALE | MALE | AGE_OVER_65 | AGE_55_65 | AGE_45_55 | AGE_35_45 | AGE_25_35 | AGE_UNDER_25 | +--------------+---------------------+--------+------+-------------+-----------+-----------+-----------+-----------+--------------+ | 231 | new york,33 | 231 | 0 | 7 | 64 | 64 | 100 | 40 | 2 | | 113 | Houston,45 | 113 | 0 | 1 | 41 | 41 | 42 | 24 | 0 | | 108 | Chicago,14 | 108 | 0 | 0 | 35 | 35 | 46 | 22 | 1 | | 92 | Dallas,45 | 92 | 0 | 4 | 28 | 28 | 40 | 12 | 2 | | 91 | Los Angeles,5 | 91 | 0 | 0 | 19 | 19 | 43 | 23 | 2 | | 88 | Atlanta,11 | 88 | 0 | 2 | 30 | 30 | 34 | 17 | 1 | | 67 | Austin,45 | 67 | 0 | 0 | 24 | 24 | 24 | 7 | 1 | | 62 | Washington,9 | 62 | 0 | 1 | 14 | 14 | 30 | 16 | 1 | | 60 | San Antonio,45 | 60 | 0 | 0 | 25 | 25 | 24 | 10 | 0 | | 58 | Denver,6 | 58 | 0 | 1 | 13 | 13 | 33 | 8 | 1 | | 57 | Philadelphia,39 | 57 | 0 | 0 | 11 | 11 | 34 | 11 | 0 | | 54 | boston,22 | 54 | 0 | 1 | 23 | 23 | 20 | 8 | 2 | | 51 | San Francisco,5 | 51 | 0 | 0 | 25 | 25 | 14 | 8 | 1 | | 50 | San Diego,5 | 50 | 0 | 1 | 9 | 9 | 20 | 15 | 2 | | 50 | Brooklyn,33 | 50 | 0 | 0 | 22 | 22 | 16 | 10 | 1 | | 45 | Miami,10 | 45 | 0 | 0 | 11 | 11 | 16 | 16 | 1 | | 43 | Seattle,50 | 43 | 0 | 0 | 14 | 14 | 18 | 6 | 2 | | 41 | Portland,38 | 41 | 0 | 0 | 8 | 8 | 16 | 7 | 0 | | 40 | Minneapolis,24 | 40 | 0 | 0 | 16 | 16 | 15 | 5 | 0 | | 40 | Las Vegas,29 | 40 | 0 | 1 | 11 | 11 | 19 | 3 | 2 | | 39 | Salt Lake City,46 | 39 | 0 | 0 | 11 | 11 | 15 | 8 | 1 | | 37 | Charlotte,34 | 37 | 0 | 0 | 12 | 12 | 19 | 3 | 0 | | 36 | San Jose,5 | 36 | 0 | 0 | 19 | 19 | 11 | 5 | 0 | | 35 | Phoenix,3 | 35 | 0 | 0 | 14 | 14 | 13 | 4 | 2 | | 35 | Indianapolis,15 | 35 | 0 | 0 | 12 | 12 | 13 | 7 | 2 | | 34 | Orlando,10 | 34 | 0 | 0 | 13 | 13 | 15 | 5 | 1 | | 34 | Fort Lauderdale,10 | 34 | 0 | 0 | 18 | 18 | 11 | 5 | 0 | | 32 | Birmingham,1 | 32 | 0 | 0 | 12 | 12 | 12 | 4 | 0 | | 31 | Tampa,10 | 31 | 0 | 1 | 10 | 10 | 11 | 5 | 1 | | 29 | Raleigh,34 | 29 | 0 | 0 | 16 | 16 | 6 | 2 | 0 | | 29 | Plano,45 | 29 | 0 | 0 | 12 | 12 | 14 | 2 | 0 | | 27 | Arlington,49 | 27 | 0 | 0 | 9 | 9 | 12 | 5 | 0 | | 26 | pittsburgh,39 | 26 | 0 | 1 | 9 | 9 | 10 | 2 | 2 | | 26 | Fort Worth,45 | 26 | 0 | 0 | 9 | 9 | 12 | 4 | 0 | | 25 | Alpharetta,11 | 25 | 0 | 0 | 9 | 9 | 15 | 1 | 0 | | 25 | Colorado Springs,6 | 25 | 0 | 0 | 7 | 7 | 12 | 4 | 0 | | 25 | Columbus,36 | 25 | 0 | 0 | 10 | 10 | 13 | 2 | 0 | | 24 | Sacramento,5 | 24 | 0 | 0 | 6 | 6 | 8 | 6 | 2 | | 23 | Cleveland,36 | 23 | 0 | 0 | 7 | 7 | 9 | 6 | 0 | | 23 | Kansas City,26 | 23 | 0 | 0 | 9 | 9 | 8 | 5 | 0 | | 23 | Beverly Hills,5 | 23 | 0 | 0 | 3 | 3 | 8 | 8 | 2 | | 23 | Hollywood,10 | 23 | 0 | 0 | 9 | 9 | 9 | 5 | 0 | | 22 | Louisville,18 | 22 | 0 | 0 | 7 | 7 | 7 | 5 | 0 | | 22 | Scottsdale,3 | 22 | 0 | 0 | 11 | 11 | 6 | 0 | 1 | | 21 | Baltimore,21 | 21 | 0 | 0 | 7 | 7 | 7 | 4 | 2 | | 21 | Cincinnati,36 | 21 | 0 | 1 | 4 | 4 | 11 | 5 | 0 | | 20 | Kingwood,45 | 20 | 0 | 0 | 15 | 15 | 3 | 0 | 0 | | 20 | Oklahoma City,37 | 20 | 0 | 0 | 3 | 3 | 11 | 4 | 0 | | 20 | Nashville,44 | 20 | 0 | 1 | 6 | 6 | 11 | 1 | 0 | | 20 | Alexandria,49 | 20 | 0 | 0 | 5 | 5 | 8 | 4 | 0 | | 20 | Saint Louis,26 | 20 | 0 | 0 | 11 | 11 | 6 | 2 | 0 | | 19 | Saint Paul,24 | 19 | 0 | 1 | 4 | 4 | 5 | 4 | 2 | | 19 | Milwaukee,52 | 19 | 0 | 0 | 5 | 5 | 7 | 6 | 0 | | 19 | Tucson,3 | 19 | 0 | 0 | 7 | 7 | 6 | 2 | 1 | | 19 | Arlington,45 | 19 | 0 | 0 | 7 | 7 | 5 | 6 | 0 | | 19 | Knoxville,44 | 19 | 0 | 0 | 8 | 8 | 5 | 5 | 0 | | 19 | Grand Rapids,23 | 19 | 0 | 0 | 7 | 7 | 7 | 5 | 0 | | 18 | Albuquerque,32 | 18 | 0 | 0 | 8 | 8 | 4 | 6 | 0 | | 18 | Long Beach,5 | 18 | 0 | 0 | 5 | 5 | 7 | 4 | 1 | | 18 | Saint Petersburg,10 | 18 | 0 | 0 | 2 | 2 | 4 | 1 | 2 | | 17 | Jacksonville,10 | 17 | 0 | 0 | 6 | 6 | 9 | 2 | 0 | | 17 | Memphis,44 | 17 | 0 | 0 | 2 | 2 | 11 | 4 | 0 | | 17 | Rochester,33 | 17 | 0 | 0 | 8 | 8 | 7 | 2 | 0 | | 17 | Virginia Beach,49 | 17 | 0 | 0 | 1 | 1 | 9 | 4 | 2 | | 16 | Staten Island,33 | 16 | 0 | 0 | 8 | 8 | 3 | 4 | 0 | | 16 | Santa Rosa,5 | 16 | 0 | 0 | 1 | 1 | 4 | 0 | 0 | | 16 | Newport Beach,5 | 16 | 0 | 0 | 5 | 5 | 7 | 4 | 0 | | 16 | Walnut Creek,5 | 16 | 0 | 0 | 11 | 11 | 3 | 0 | 0 | | 15 | Aurora,6 | 15 | 0 | 0 | 10 | 10 | 3 | 0 | 1 | | 14 | Omaha,28 | 14 | 0 | 0 | 5 | 5 | 3 | 4 | 1 | | 14 | Henderson,29 | 14 | 0 | 0 | 8 | 8 | 5 | 0 | 1 | | 14 | White Plains,33 | 14 | 0 | 0 | 3 | 3 | 6 | 3 | 0 | | 14 | Bakersfield,5 | 14 | 0 | 1 | 3 | 3 | 5 | 2 | 0 | | 14 | Frisco,45 | 14 | 0 | 0 | 5 | 5 | 7 | 1 | 1 | | 14 | Oakland,5 | 14 | 0 | 0 | 6 | 6 | 7 | 1 | 0 | | 14 | Riverside,5 | 14 | 0 | 1 | 3 | 3 | 5 | 3 | 0 | | 14 | Boca Raton,10 | 14 | 0 | 0 | 2 | 2 | 3 | 5 | 0 | | 14 | Buffalo,33 | 14 | 0 | 0 | 6 | 6 | 2 | 2 | 1 | | 14 | Spring,45 | 14 | 0 | 0 | 5 | 5 | 6 | 1 | 1 | | 14 | Reno,29 | 14 | 0 | 0 | 2 | 2 | 8 | 3 | 0 | | 14 | Columbia,42 | 14 | 0 | 0 | 4 | 4 | 6 | 4 | 0 | | 14 | Tacoma,50 | 14 | 0 | 0 | 6 | 6 | 6 | 1 | 1 | | 14 | Pompano Beach,10 | 14 | 0 | 0 | 4 | 4 | 7 | 1 | 0 | | 14 | Stamford,7 | 14 | 0 | 0 | 5 | 5 | 5 | 1 | 0 | | 13 | Conroe,45 | 13 | 0 | 0 | 2 | 2 | 7 | 2 | 0 | | 13 | Englewood,6 | 13 | 0 | 0 | 2 | 2 | 9 | 1 | 0 | | 13 | Chandler,3 | 13 | 0 | 1 | 7 | 7 | 3 | 0 | 0 | | 13 | West Palm Beach,10 | 13 | 0 | 1 | 4 | 4 | 3 | 3 | 0 | | 13 | Glendale,3 | 13 | 0 | 0 | 4 | 4 | 6 | 0 | 1 | | 13 | Ann Arbor,23 | 13 | 0 | 0 | 3 | 3 | 4 | 5 | 0 | | 13 | Lexington,18 | 13 | 0 | 0 | 5 | 5 | 4 | 1 | 1 | | 13 | Pasadena,5 | 13 | 0 | 0 | 4 | 4 | 6 | 1 | 0 | | 13 | Marietta,11 | 13 | 0 | 0 | 3 | 3 | 8 | 2 | 0 | | 13 | Madison,52 | 13 | 0 | 0 | 8 | 8 | 5 | 0 | 0 | | 12 | Fairfield,7 | 12 | 0 | 0 | 6 | 6 | 4 | 0 | 0 | | 12 | Fresno,5 | 12 | 0 | 0 | 3 | 3 | 6 | 0 | 0 | | 12 | Palo Alto,5 | 12 | 0 | 0 | 7 | 7 | 4 | 1 | 0 | | 12 | Fredericksburg,49 | 12 | 0 | 0 | 8 | 8 | 2 | 2 | 0 | | 12 | Naperville,14 | 12 | 0 | 0 | 4 | 4 | 6 | 0 | 1 | | 12 | Bronx,33 | 12 | 0 | 0 | 2 | 2 | 9 | 1 | 0 | +--------------+---------------------+--------+------+-------------+-----------+-----------+-----------+-----------+--------------+ 100 rows in set (19.80 sec) mysql> select count(*) as PAID_DELETES, 'USA' as COUNTRY, sum(case when gender=1 then 1 else 0 end) as FEMALE, sum(case when gender=2 then 1 else 0 end) as MALE, sum(case when dob < '1950-06-30' then 1 else 0 end) as AGE_OVER_65, sum(case when dob between '1960-07-01' and '1970-06-30' then 1 else 0 end) as AGE_55_65, sum(case when dob between '1960-07-01' and '1970-06-30' then 1 else 0 end) as AGE_45_55, sum(case when dob between '1970-07-01' and '1980-06-30' then 1 else 0 end) as AGE_35_45, sum(case when dob between '1980-07-01' and '1990-06-30' then 1 else 0 end) as AGE_25_35, sum(case when dob > '1990-06-30' then 1 else 0 end) as AGE_UNDER_25 from us_am_am_member where first_name='' group by gender; +--------------+---------+--------+--------+-------------+-----------+-----------+-----------+-----------+--------------+ | PAID_DELETES | COUNTRY | FEMALE | MALE | AGE_OVER_65 | AGE_55_65 | AGE_45_55 | AGE_35_45 | AGE_25_35 | AGE_UNDER_25 | +--------------+---------+--------+--------+-------------+-----------+-----------+-----------+-----------+--------------+ | 8701 | USA | 8701 | 0 | 110 | 3101 | 3101 | 3311 | 1314 | 152 | | 106806 | USA | 0 | 106806 | 2784 | 30974 | 30974 | 35098 | 22746 | 1659 | +--------------+---------+--------+--------+-------------+-----------+-----------+-----------+-----------+--------------+ 2 rows in set (48.29 sec) mysql> select count(*) as PAID_DELETES, 'USA' as COUNTRY, sum(case when gender=1 then 1 else 0 end) as FEMALE, sum(case when gender=2 then 1 else 0 end) as MALE, sum(case when dob < '1950-06-30' then 1 else 0 end) as AGE_OVER_65, sum(case when dob between '1960-07-01' and '1970-06-30' then 1 else 0 end) as AGE_55_65, sum(case when dob between '1960-07-01' and '1970-06-30' then 1 else 0 end) as AGE_45_55, sum(case when dob between '1970-07-01' and '1980-06-30' then 1 else 0 end) as AGE_35_45, sum(case when dob between '1980-07-01' and '1990-06-30' then 1 else 0 end) as AGE_25_35, sum(case when dob > '1990-06-30' then 1 else 0 end) as AGE_UNDER_25 from sc_am_am_member where first_name='' group by gender; +--------------+---------+--------+------+-------------+-----------+-----------+-----------+-----------+--------------+ | PAID_DELETES | COUNTRY | FEMALE | MALE | AGE_OVER_65 | AGE_55_65 | AGE_45_55 | AGE_35_45 | AGE_25_35 | AGE_UNDER_25 | +--------------+---------+--------+------+-------------+-----------+-----------+-----------+-----------+--------------+ | 98 | USA | 98 | 0 | 1 | 34 | 34 | 34 | 22 | 0 | | 1213 | USA | 0 | 1213 | 35 | 351 | 351 | 394 | 242 | 18 | +--------------+---------+--------+------+-------------+-----------+-----------+-----------+-----------+--------------+ 2 rows in set (0.47 sec)