【发布时间】:2020-12-07 18:01:55
【问题描述】:
大家早上好!本质上,我发现我想使用的潜在 table.field 可能没有我想要的信息,所以我可能不得不查看一个单独的字段。我下面的思考过程是:
If table.field1 = NULL then pull the value from table.field2. If table.field2 = NULL then state "No Phone"
我当前在select中的sql语句,由于是某种格式,是:
substring(view_episode_summary_current.patient_home_phone, 1, 3) || ' ' || substring(view_episode_summary_current.patient_home_phone, 5, 8)
上面是table.field1。我假设我需要创建一个 CASE 语句,对吗?就是不知道要多久?
(case when view_episode_summary_current.patient_home_phone = NULL then table.field2)
但我不知道如何让它评估 if table.field2 = null 并显示该值。
【问题讨论】: