update sqlc gen

This commit is contained in:
Pavel 2024-03-17 20:05:29 +03:00
parent 6d16c45925
commit a68161f19b
2 changed files with 16 additions and 4 deletions

@ -517,7 +517,10 @@ WITH Funnel AS (
SELECT SELECT
q.title AS question_title, q.title AS question_title,
ta.total_answers, ta.total_answers,
CAST(COUNT(*) * 100.0 / NULLIF(ta.total_answers, 0) AS INTEGER) AS percentage CASE
WHEN ta.total_answers = 0 THEN 0
ELSE CAST(COUNT(*)::FLOAT / NULLIF(ta.total_answers, 0) AS INTEGER)
END AS percentage
FROM FROM
answer a answer a
JOIN JOIN
@ -539,7 +542,10 @@ WITH Funnel AS (
q.id, q.id,
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 CASE
WHEN q.total_answers = 0 THEN 0
ELSE CAST(COUNT(*)::FLOAT / NULLIF(q.total_answers, 0) AS INTEGER)
END AS percentage
FROM FROM
answer a answer a
JOIN ( JOIN (

@ -1611,7 +1611,10 @@ WITH Funnel AS (
SELECT SELECT
q.title AS question_title, q.title AS question_title,
ta.total_answers, ta.total_answers,
CAST(COUNT(*) * 100.0 / NULLIF(ta.total_answers, 0) AS INTEGER) AS percentage CASE
WHEN ta.total_answers = 0 THEN 0
ELSE CAST(COUNT(*)::FLOAT / NULLIF(ta.total_answers, 0) AS INTEGER)
END AS percentage
FROM FROM
answer a answer a
JOIN JOIN
@ -1633,7 +1636,10 @@ WITH Funnel AS (
q.id, q.id,
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 CASE
WHEN q.total_answers = 0 THEN 0
ELSE CAST(COUNT(*)::FLOAT / NULLIF(q.total_answers, 0) AS INTEGER)
END AS percentage
FROM FROM
answer a answer a
JOIN ( JOIN (