SELECT
CASE ua
WHEN 'IE' THEN family || '_'|| version
WHEN 'Chrome' THEN family
WHEN 'Firefox' THEN family
WHEN 'Safari' THEN family
WHEN 'Opera' THEN family
ELSE 'Other'
END
SELECT coalesce(a, b)
-- IEだけversion付けたいみたいなとき
SELECT
if(family='IE', family || version, family)
SELECT a || '_' || b
FROM *
WITH config AS (
SELECT
TD_TIME_ADD(TD_SCHEDULED_TIME(),'-10d', 'JST') AS start_time,
TD_TIME_ADD(TD_SCHEDULED_TIME(),'-1d', 'JST') AS end_time
)
SELECT *
FROM access, config
WHERE TD_TIME_RANGE(time, config.start_time, config.end_time, 'JST')
WITH
config AS (
SELECT 2 AS val_a
),
tbl AS (
SELECT
val_a,
some_value * val_a -- some_value * 2
FROM some_table, config
)
SELECT * FROM tbl
WITH a AS (
SELECT * FROM some_table
),
b AS (
SELECT * FROM a
),
c AS (
SELECT * FROM a
)
SELECT * FROM c, b
WITH a AS (
SELECT * FROM some_table
),
b AS (
SELECT * FROM a
),
c AS (
SELECT * FROM b
)
SELECT * FROM c
SELECT TD_SESSIONIZE(time, 3600, ip_address) as session_id
FROM ...
ORDER BY ip_address, time -- ソートする
SELECT
*
TD_PARSE_AGENT(user_agent)['ua_family'] AS family,
TD_PARSE_AGENT(user_agent)['ua_major'] AS version
FROM
access
WHERE TD_PARSE_AGENT(user_agent) IN ['pc', 'smartphone']
WITH a AS (
SELECT
TD_PARSE_AGENT(user_agent)['ua_family'] AS family,
TD_PARSE_AGENT(user_agent)['ua_major'] AS version
FROM
access
),
b AS (
SELECT
if(family = 'IE', family || version, family) AS browser
FROM b
),
SELECT
TD_PARSE_AGENT(user_agent)['os_family']
TD_PARSE_AGENT(user_agent)['os_major']
TD_PARSE_AGENT(user_agent)['os_minor']
TD_PARSE_AGENT(user_agent)['ua_family']
TD_PARSE_AGENT(user_agent)['ua_major']
TD_PARSE_AGENT(user_agent)['ua_minor']
TD_PARSE_AGENT(user_agent)['device']
FROM access