create_tables.pgsql
changeset 9 e3d3dbeb5b84
parent 8 7e3ce56f49e6
child 13 1d9bf63a86f7
equal deleted inserted replaced
8:7e3ce56f49e6 9:e3d3dbeb5b84
   132 
   132 
   133 CREATE OR REPLACE VIEW vmm_alias_count AS
   133 CREATE OR REPLACE VIEW vmm_alias_count AS
   134     SELECT count(DISTINCT address) AS aliases, gid
   134     SELECT count(DISTINCT address) AS aliases, gid
   135       FROM alias 
   135       FROM alias 
   136   GROUP BY gid;
   136   GROUP BY gid;
       
   137 
       
   138 CREATE OR REPLACE VIEW vmm_domain_info AS
       
   139     SELECT gid, domainname, transport, domaindir, count(uid) AS accounts,
       
   140            aliases
       
   141       FROM domains
       
   142            LEFT JOIN transport USING (tid)
       
   143            LEFT JOIN users USING (gid)
       
   144            LEFT JOIN vmm_alias_count USING (gid)
       
   145   GROUP BY gid, domainname, transport, domaindir, aliases;