Database view group by clause

salihyakici
Kilo Explorer

I created database view with using cmdb tables ,

I want to use gruop by cluase in Database views where clause like SQL .   I think , where cluase does not support it .

How do you solve this ? script or another method ?

Regards, Thanks ,

Salih

4 REPLIES 4

sergiu_panaite
ServiceNow Employee
ServiceNow Employee

Indeed, when creating database views you can't use WHERE clause as in SQL or group by.


But, once a database view is created you can access it via:



- <databaseviewname>.list and in the list view you can use group by


- get group by in GlideAggregate scripting



Regards,


Thanks Sergiu ,


Where can I write this script ,


in business rule , client scripts or ?  



Thanks,


What's the business case? What do you want to do with this database view?



Regards,


When creating database view   Servicenow generate Rest Api for this view,


I am using this Rest Api for someone Integration.


But I must group by some attributes on this view. I do not know where I would use GlideAggarete script for grouping .



Thanks ,