gpt4 book ai didi

mysql - 当第一个为空时我们如何切换列

转载 作者:行者123 更新时间:2023-11-29 13:19:04 26 4
gpt4 key购买 nike

当第一列为 NULL 用于提取数据,并且第二列通过 Join 命令与另一个表连接时,如何将命令定向到第二列。

    Select
competitions.name as "Competition",
to_char(to_date(date,'DY Mon DD YYYY'),'D.MM.YYYY') as "Date Aired",
case when home_team.name Is null then to_char(to_date(date,'DY Mon DD YYYY'),'MM-DD')||' '||video_jobs.event else
to_char(to_date(date,'DY Mon DD YYYY'),'MM-DD')||' '||Away_team.name||' '||'@'||' '||home_team.name end as "Title",
min(case when new_status_id = 19 then to_char(timestamp,'DD.MM.YY') end) as "Analysis Start date",
min(case when new_status_id = 13 then to_char(timestamp,'DD.MM.YY') end) as "Analysis Complete",
min(case when new_status_id = 9 then to_char(timestamp,'DD.MM.YY') end) as "Upload complete"

from video_jobs

Join job_statuses on video_jobs.status_id = job_statuses.id
join teams as Home_team on video_jobs.home_team_id = home_team.id
join teams as Away_team on video_jobs.away_team_id = Away_team.id
Join competitions on video_jobs.competition_id = competitions.id
Join video_job_status_history on video_jobs.id = video_job_status_history.video_job_id

Where video_jobs.id = 163887 --and video_jobs.market_id=9
-- and video_jobs.status_id != 32

group by
video_jobs.id,
competitions.name,
home_team.name,

最佳答案

您的问题还很不清楚,但我相信您正在寻找 coalesce 函数,Postgres 都支持该函数。和 MySQL .

关于mysql - 当第一个为空时我们如何切换列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21098593/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com