The CreatorCon Call for Content is officially open! Get started here.

SQL "Distinct" functionality in database view

alessandro_pino
Giga Contributor

Hello Experts,

I trying to build database view on CMDB tables. please see below screen shots.

Capture.JPG


When i am trying to do left join on last two tables, i am getting duplicate records.
Also, can you let me know how i can incoporate SQL "Distinct" Keyword functionality on any coloumn or field in database view.


Thanks,
Alessandro.

1 REPLY 1

Brad Tilton
ServiceNow Employee
ServiceNow Employee

Hi Alessandro,



I don't think there's anything you can do specifically through the database view, but you could just group by a specific column on the view of the records. You could also do a GlideAggregate() query and use groupby from a script. I know it's not exactly what you're looking for, but it might get you closer.



Glide Record Aggregate "Distinct"


GlideAggregate - ServiceNow Wiki