update sqlc gen

This commit is contained in:
Pavel 2024-03-17 20:45:06 +03:00
parent 716f49bc49
commit 7360a1350a
2 changed files with 6 additions and 8 deletions

@ -538,14 +538,13 @@ WITH Funnel AS (
SELECT SELECT
q.title AS question_title, q.title AS question_title,
a.content AS answer_content, a.content AS answer_content,
CAST(COUNT(*) * 100.0 / NULLIF(q.total_answers, 0) AS INTEGER) AS percentage CAST(COUNT(*) * 100.0 / NULLIF(SUM(COUNT(*)) OVER (PARTITION BY q.id), 0) AS INTEGER) AS percentage
FROM FROM
answer a answer a
JOIN ( JOIN (
SELECT SELECT
q.id, q.id,
q.title, q.title
COUNT(*) AS total_answers
FROM FROM
question q question q
JOIN JOIN
@ -562,7 +561,7 @@ WITH Funnel AS (
AND a.created_at >= TO_TIMESTAMP($2) AND a.created_at >= TO_TIMESTAMP($2)
AND a.created_at <= TO_TIMESTAMP($3) AND a.created_at <= TO_TIMESTAMP($3)
GROUP BY GROUP BY
q.title, a.content, q.total_answers q.title, a.content, q.id
HAVING HAVING
COUNT(*) >= 1 COUNT(*) >= 1
) )

@ -1632,14 +1632,13 @@ WITH Funnel AS (
SELECT SELECT
q.title AS question_title, q.title AS question_title,
a.content AS answer_content, a.content AS answer_content,
CAST(COUNT(*) * 100.0 / NULLIF(q.total_answers, 0) AS INTEGER) AS percentage CAST(COUNT(*) * 100.0 / NULLIF(SUM(COUNT(*)) OVER (PARTITION BY q.id), 0) AS INTEGER) AS percentage
FROM FROM
answer a answer a
JOIN ( JOIN (
SELECT SELECT
q.id, q.id,
q.title, q.title
COUNT(*) AS total_answers
FROM FROM
question q question q
JOIN JOIN
@ -1656,7 +1655,7 @@ WITH Funnel AS (
AND a.created_at >= TO_TIMESTAMP($2) AND a.created_at >= TO_TIMESTAMP($2)
AND a.created_at <= TO_TIMESTAMP($3) AND a.created_at <= TO_TIMESTAMP($3)
GROUP BY GROUP BY
q.title, a.content, q.total_answers q.title, a.content, q.id
HAVING HAVING
COUNT(*) >= 1 COUNT(*) >= 1
) )