# qryOrgLargeSMR.sql # SQL # n6lhv@arrl.net (Wayne Smith) # Display the MySQL version SELECT version(); # Switch to the correct database USE uls # delete the table if it exists (it probably does) DROP TABLE IF EXISTS tblOrgLargeSMR; # Join the relevant data into a "flat" table CREATE TABLE tblOrgLargeSMR #EXPLAIN SELECT DISTINCT * FROM tblGeoStateCA WHERE (entity_name LIKE '%SOBEL%' AND NOT (entity_name LIKE '%N6LHV%')) OR (entity_name LIKE '%KAY%' AND NOT (entity_name LIKE '%KAYLEEN%' OR entity_name LIKE '%KAYE%' OR entity_name LIKE '%INTERNATIONAL%' OR entity_name LIKE '%YOKAYO%' OR entity_name LIKE '%BEE%' OR entity_name LIKE '%KENNETH%')) OR ((entity_name LIKE '%MOBILE%' AND entity_name LIKE '%RELAY%')) OR ((entity_name LIKE '%BRYANT%' AND entity_name LIKE '%KAY%')) ORDER BY frequency_assigned, call_sign, radio_service_code, class_station_code, location_state, location_county, location_city, location_address ;