<?php

$SQL = "create view view_pzfacts as

          select pzfacts.*,
                 date_format(pzfact_created,     '%c/%e/%Y %l:%i %p') as pzfact_created_verbose,
                 date_format(pzfact_changed,     '%c/%e/%Y %l:%i %p') as pzfact_changed_verbose,
                 date_format(pzfact_entry_date,  '%c/%e/%Y')          as pzfact_entry_date_verbose,
                 date_format(pzfact_action_date, '%c/%e/%Y')          as pzfact_action_date_verbose,
          
                 counties.county_name                                 as pzfact_county_name_verbose,
                 projectcity.city_name                                as project_city_verbose,

                 projecttypes.dropdown_value                          as pzfact_project_type_verbose,
                 actioncodes.dropdown_value                           as pzfact_action_code_verbose

            from pzfacts

       left join counties
              on counties.county_serial        = pzfacts.pzfact_county
              
       left join cities as projectcity
              on projectcity.city_serial       = pzfacts.pzfact_project_city
              
        left join dropdowns as projecttypes
              on projecttypes.dropdown_serial  = pzfacts.pzfact_project_type
              
        left join dropdowns as actioncodes
              on actioncodes.dropdown_serial     = pzfacts.pzfact_action_code";
?>