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!



_______________________________________________

UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net

Reply via email to