Creating a database view with advanced query
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2023 04:55 AM
I have a colleague that wants some detailed information about time worked on cases. We have the table task_time_worked that records time worked. It has a reference field "task" that links the time worked to a case in the table sn_customerservice_case. Each time_worked has the field rate_type. For simplicity's sake, let's say it can be one of two values: N or B.
My colleague wants to see all the cases that have occurrences of task_time_worked with both rate types. In other words, all cases with at least one task_time_worked with rate type N AND at least one task_time_worked with rate type B.
I doesn't seem possible to get this type of result from a query on a list view on one of the two tables. I have messed around a bit with database views, which I'm fairly new to, but haven't really gotten anywhere. I think I might be able to make a script that returns an array with the correct case sys_id's, but how can I communicate this in a view/report to my colleague?
Any tips would be appreciated.