database view: Where clause in view ... has an invalid field or a field that is not visible

thebananek
Tera Contributor

Wish to have database view based on join between sys_audit.documentkey and cmdb_ci.sys_id fields. Error: Where clause in view u_cmdb_ci_changes has an invalid field or a field that is not visible (SA_documentkey)
I have no idea what I am doing wrong 😕

thebananek_0-1722281752119.pngthebananek_1-1722281777843.pngthebananek_2-1722281805607.png

 

3 REPLIES 3

thebananek
Tera Contributor

ok, got it 😄
sa_documentkey = ci_sys_id instead of SA_documentkey = CI_sys_id

Bert_c1
Kilo Patron

It is not a good idea to include the sys_audit table, it is huge and is likely to cause performance problems.

Is it better if BR runs before query from DB view and narrows records to created on last 7 days and add additional conditions?
Ex. sa_fieldname=discovery_source^ORsa_fieldname=operational_status^sa_sys_created_onONLast 7 days@javascript:gs.beginningOfLast7Days()@javascript:gs.endOfLast7Days()