[improvement][headless]Support s2sql with union all statements.

This commit is contained in:
jerryjzhang
2024-12-27 11:25:33 +08:00
parent ce9ae1c0c1
commit ade03627ce
6 changed files with 154 additions and 18 deletions

View File

@@ -0,0 +1,34 @@
WITH
recent_week AS (
SELECT
SUM(访) AS _访问次数_,
COUNT(DISTINCT ) AS _访问用户数_
FROM
WHERE
>= '2024-12-20'
AND <= '2024-12-27'
),
first_week_december AS (
SELECT
SUM(访) AS _访问次数_,
COUNT(DISTINCT ) AS _访问用户数_
FROM
WHERE
>= '2024-12-01'
AND <= '2024-12-07'
)
SELECT
'最近7天' AS _时间段_,
_访问次数_,
_访问用户数_
FROM
recent_week
UNION ALL
SELECT
'12月第一个星期' AS _时间段_,
_访问次数_,
_访问用户数_
FROM
first_week_december

View File

@@ -0,0 +1,29 @@
WITH
weekly_visits AS (
SELECT
YEAR () AS _year_,
WEEK () AS _week_,
SUM(访) AS total_visits
FROM
WHERE
(
>= '2024-11-18'
AND <= '2024-11-25'
)
GROUP BY
YEAR (),
WEEK ()
)
SELECT
_year_,
_week_,
total_visits
FROM
weekly_visits
WHERE
(_year_ = YEAR (CURRENT_DATE))
ORDER BY
total_visits DESC
LIMIT
1