'SQL-getting error-"Message=ORA-00918: column ambiguously defined"
I am getting error "Message=ORA-00918: column ambiguously defined" What I would do to solve this. Thanks
With status as(
Select
lemnum,
count(
case when status = 'COMP' then linenum end
) as COMP_line,
count(
case when status = 'POSTED' then linenum end
) as POSTED_line,
count(
case when status = 'SUBMIT' then linenum end
) as SUBMIT_line,
count(
case when status = 'WAPPR' then linenum end
) as WAPPR_line
FROM
BI_HZ_ETL.LEM_FACTS
Group by
lemnum
)
SELECT
status.*,
v.vendor_name,
LINENUM,
LEMNUM,
VENDOR,
WORKDATE,
SITEID,
laborhrs,
equiphrs
FROM
BI_HZ_ETL.LEM_FACTS lf
left join status on (LEMNum = lf.LEMNUM)
Left JOIN bi_hz_etl.LEM_vendor v ON (lf.vendor = vendor_id)
where
siteid in('HORIZON', 'ALBIAN')
and STATUS not in('DELETED', 'NEW', 'REJECT')
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
