单独查询 这个视图 是可以的 hr_db.view_ods_employee_ehr_df 但是如果组合式图再去跟外部表查询是会报错的
SELECT name,workcode,td_day,type
from (
SELECT
name,WorkCode
from
hr_db.view_ods_employee_ehr_df
where FirstRankDept ='股份本部' and EmployStatus ='在职' and SecondRankDept not in ('高管','其他','退休人员')
) a
cross join
(
SELECT
CalendarDate td_day,
type
from
(
SELECT SUBSTR(CalendarDate,1,10) CalendarDate FROM jdbc_ehr_sqlserver_pro.dbo.CalendarDay
WHERE CalendarID = 1 and DateType = 120200000 and SUBSTR(CalendarDate,1,7)= SUBSTR(NOW() ,1,7)
) b
)a
错误如下
SQL 错误 [1054] [42S22]: errCode = 2, detailMessage = Unknown column 'PositionID' in 'jdbc_ehr_sqlserver_pro.dbo.a'
hr_db.view_ods_employee_ehr_df 也是基于外部表写的临时视图