bland annat att slå ihop flera tabeller till en:
Riktigt nice SQL query!
CREATE OR REPLACE VIEW platser AS
select name, gc.id, CONCAT(‘county’) as type
from geo_counties gc
union
select name, gk.id, CONCAT(‘municipality’) as type
from geo_kommuner gk
union
select name, go.id, CONCAT(‘city’) as type
from geo_orter go;
SELECT * FROM platser;
______________________________________________________________________________________________________
Värdefullt SQL replace exempel
http://www.electrictoolbox.com/mysql-select-replace/
# KMP.platsTyp, KMP.plats_id
# GROUP_CONCAT(DISTINCT i.intresse) intressen,
# CONCAT_WS(‘,’,GROUP_CONCAT(DISTINCT gk.name), GROUP_CONCAT(DISTINCT gc.name), GROUP_CONCAT(DISTINCT go.name)) as platser#,
# REPLACE(REPLACE(REPLACE( platsTyp, ‘län’, ‘county’ ), ‘kommun’, ‘municipality’), ‘ort’, ‘city’) as platsTyp