use av_aman; CREATE or replace ALGORITHM = UNDEFINED DEFINER = `av_aman`@`localhost` SQL SECURITY DEFINER VIEW `vw_addresses` AS SELECT `a`.`country_id` AS `country_id`, IFNULL(`a`.`con_name`, 'No Country') AS `con_name`, `a`.`con_full_name` AS `con_full_name`, `a`.`con_code` AS `con_code`, `a`.`lk_design` AS `lk_design`, `a`.`lk_design_hex` AS `lk_design_hex`, `a`.`con_digit` AS `con_digit`, `b`.`state_id` AS `state_id`, IFNULL(`b`.`state_name`, 'No State') AS `state_name`, IFNULL(`b`.`state_full_name`, 'No State Full Name') AS `state_full_name`, `h`.`idlook_county_district` AS `idlook_county_district`, IFNULL(`h`.`county_district_city_nm`, 'No County') AS `county_district_city_nm`, `c`.`city_id` AS `city_id`, IFNULL(`c`.`city_name`, 'No City') AS `city_name`, IFNULL(`d`.`postal_id`, 'No Postal Id') AS `postal_id`, IFNULL(`d`.`zip_code`, 'No Zip Code') AS `zip_code`, `e`.`look_street_id` AS `look_street_id`, IFNULL(`e`.`street_name`, 'No Street Name') AS `street_name`, `f`.`look_street_no_id` AS `look_street_no_id`, IFNULL(`f`.`look_street_no`, 'No Street') AS `look_street_no`, IFNULL(`e`.`street_type`, 'No Street Type') AS `street_type`, IFNULL(`g`.`lk_val`, 'No Street Type') AS `street_type_nm`, CONCAT(IFNULL(`e`.`street_name`, 'No Street Name'), ' ', IFNULL(`g`.`lk_val`, 'No Street Type')) AS `street_name_type`, CONCAT(IFNULL(`f`.`look_street_no`, 'No Street '), ' ', IFNULL(`e`.`street_name`, 'No Street, '), ' ', IFNULL(`g`.`lk_val`, 'No Street Type'), ' ', IFNULL(`c`.`city_name`, 'No City, '), ' (', IFNULL(`h`.`county_district_city_nm`, 'No County'), '), ', IFNULL(`b`.`state_name`, 'No State, '), ' ', IFNULL(`d`.`zip_code`, 'No Zip Code, '), ' ', '(', IFNULL(`a`.`con_name`, 'No Country'), ')') AS `addresses` FROM (((((((`look_country` `a` LEFT JOIN `look_state` `b` ON ((`a`.`country_id` = `b`.`country_id`))) LEFT JOIN `look_county_district` `h` ON ((`b`.`state_id` = `h`.`state_id`))) LEFT JOIN `look_city` `c` ON ((`h`.`idlook_county_district` = `c`.`idlook_county_district`))) LEFT JOIN `look_postal` `d` ON ((`c`.`city_id` = `d`.`city_id`))) LEFT JOIN `look_street` `e` ON ((`d`.`postal_id` = `e`.`postal_id`))) LEFT JOIN `look_street_no` `f` ON ((`e`.`look_street_id` = `f`.`look_street_id`))) LEFT JOIN `feature_lk_val` `g` ON ((`e`.`street_type` = `g`.`idfeature_lk_val`)))