나는 열로 계산을하려고하지만, .There를 실패하는 것하고는 차이라는 럼없는케이스 SQL 컬럼 계산
라인은 전체 스크립트는
case d.gap when a.actual_value IS TRUE then (quar_target - a.actual_value) else 'NULL' END ,
입니다
SELECT
weekly.* ,
quarterly.target_value as quar_target
FROM (
SELECT a.week_id,
d.region_id,
d.region_name,
d.metric_id ,
case d.metric_desc
when 'BE GMV Lift' then 'GMV Lift'
when 'B2C GMV Lift' then 'GMV Lift'
when 'Trust GMV Lift' then 'GMV Lift'
else d.metric_desc
end as metric_desc,
case d.gap
when a.actual_value IS TRUE
then (quar_target - a.actual_value)
else 'NULL' END,
d.ini_name ,
a.actual_value ,
a.actual_txt ,
a.target_value ,
a.target_txt ,
a.signals ,
a.comments
FROM
-- Get most recently reported records. If the metric is not reported for this week, get the last reported number
(SELECT *
FROM l1_weekly_entry
WHERE week_id=WEEK(CURDATE(), 1) - 1
) a
열을 소개하려고합니다. d.gap
는 "하지만 실패 할 것"실제로 어떤 의미가 테이블에 있기 때문에
그래서 전체 쿼리
d.metric_desc
근무 같은이같은 것? –
귀하의 별칭이 될 수 있습니다 "d"는 열 "갭"이 없다는 것을 확인하십시오 – KuldipMCA
예 !! # 1054 - 필드 목록에서 알 수없는 'd.gap'열 – user2300435