How to write this script to join 2 tables?
I’m not an expert in ServiceNow but from what I see you are trying to push SQL-like query here. For joining two tables in SQL query the “Join” command is responsible for. So if you have table1 and table2 you need to join them using common column. Something like this:
ONtable1.id = table2.table1_id
Where table1.id and table2.table1_id are the columns in each table which consist the same data. Common part of both tables.
I tried with your suggestion but getting an error.
I have checked this with proper team. Seems that for SeviceNow only one single objects can be queried. It’s the intentional limitation from SN. Anyway in longer perspective this might be something which will be implemented.
For joining Two table we can use below query
table2 t2 ON t1.id = t2.table1_id
where t1.data=1 limit=1
Please read carefully as I proposed the same but after checking it with proper team I wrote:
By objects I meant singe table without any join.