<?php

$SQL = "create view view_businessfacts as

          select businessfacts.*,
                 date_format(businessfact_created, '%c/%e/%Y %l:%i %p') as businessfact_created_verbose,
                 date_format(businessfact_changed, '%c/%e/%Y %l:%i %p') as businessfact_changed_verbose,
                 date_format(businessfact_entry_date, '%c/%e/%Y')       as businessfact_entry_date_verbose,
                 date_format(businessfact_license_date, '%c/%e/%Y')     as businessfact_license_date_verbose,
                 date_format(businessfact_lease_end, '%c/%e/%Y')        as businessfact_lease_end_verbose,
          
                 counties.county_name                                   as businessfact_county_name_verbose,
                 businessfactcity.city_name                             as businessfact_city_verbose,
                 siccodes.siccode_description                           as businessfact_siccode_description_verbose,
                 businessclassifications.dropdown_value                 as businessfact_business_class_verbose,
                 actions.dropdown_value                                 as businessfact_action_verbose

            from businessfacts

       left join counties
              on counties.county_serial = businessfacts.businessfact_county
              
       left join cities as businessfactcity
              on businessfactcity.city_serial = businessfacts.businessfact_city
              
       left join siccodes
              on siccodes.siccode_code = businessfacts.businessfact_sic_code
              
        left join dropdowns as actions
              on actions.dropdown_serial = businessfacts.businessfact_action
              
        left join dropdowns as businessclassifications
              on businessclassifications.dropdown_serial = businessfacts.businessfact_business_class
              
        ";
?>