[UPHPU] database architecture for type with 2 parents

Richard K Miller richardkmiller at gmail.com
Sat Sep 20 18:25:34 MDT 2008


Roberto, Brandon, and Ray: thanks for your answers to my database  
architecture questions. They were very helpful.

> Why shouldn't subdomains and domains be in the same table? Would
> certainly simplify things.

I'll have to see what legacy reason we had for separating domains and  
subdomains into different tables. <sarcasm>I'm sure there's a really  
good reason.</sarcasm>

> CREATE VIEW mysitesview AS
> SELECT m.id, m.type, COALESCE(d.domain, sd.domain) AS site,  
> m.hosting, m.fk_id
> FROM  mysites m
>    LEFT OUTER JOIN domain d ON m.fk_id = d.id AND m.type = 'domain'
>    LEFT OUTER JOIN subdomain sd ON m.fk_id = sd.id AND m.type =  
> 'subdomain'

This query worked great, as did Brandon's query with if() instead of  
coalesce(). And the resulting VIEW can be edited -- exactly what I  
wanted. Thanks!




More information about the UPHPU mailing list