mirror of https://github.com/LemmyNet/lemmy.git
31 lines
499 B
SQL
31 lines
499 B
SQL
DROP VIEW site_view;
|
|
|
|
CREATE VIEW site_view AS
|
|
SELECT
|
|
*,
|
|
(
|
|
SELECT
|
|
name
|
|
FROM
|
|
user_ u
|
|
WHERE
|
|
s.creator_id = u.id) AS creator_name,
|
|
(
|
|
SELECT
|
|
count(*)
|
|
FROM
|
|
user_) AS number_of_users,
|
|
(
|
|
SELECT
|
|
count(*)
|
|
FROM
|
|
post) AS number_of_posts,
|
|
(
|
|
SELECT
|
|
count(*)
|
|
FROM
|
|
comment) AS number_of_comments
|
|
FROM
|
|
site s;
|
|
|