how to get only latest record in database view

Kumar116
Tera Contributor

Hello

Is there anyway to get latest record in database view. i have created a database view but its showing duplicate records. i need only unique records, is it possible.

5 REPLIES 5

Robbie
Kilo Patron
Kilo Patron

Hi Kumar,

Unfortunately I don't think there's anything you can do specifically through the database view, but you can just group by a specific column on the view of the records. Alternatively you can create a report using count distinct on the specific value using your database view as the source.

You could also implement 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.

 

See below links that can also help:

Glide Record Aggregate "Distinct"

GlideAggregate - ServiceNow Wiki

 

To help others, please mark correct and/or helpful.

Thanks,

Robbie

Kumar116
Tera Contributor

I need to get list report out of this db view

Hi Kumar,

Can you share an image of your database view or explain the database join if using custom tables please? You maybe returning duplicate records from the type of join(s) for example.

Please mark as helpful and/or correct in order to help others.

Thanks,

Robbie

 

Kumar116
Tera Contributor

Hi Robbie,

Here is the image of db view,

find_real_file.png