- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2024 07:32 AM - edited 08-16-2024 07:32 AM
Hello- I have a custom table - u_aws that when triggered a survey goes out.
I have created a database view for reporting (u_report).
One of the fields on that DB view is TriggerID: Number (number of the record on u_aws).
I now need to grab a field from u_aws (queue_name) for the database view.
I'm struggling on how to write this where clause. I keep getting an error.
I'm adding u_aws with prefix dbaws to the database view.
What should my where clause be and should it join left?
Thank you!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2024 07:46 AM
This is difficult to follow without a picture of the existing working Database View, and with at least one custom table, but generally you only want a left join if you want to include all of the records from one of tables even if it doesn't have a record on the other table in the join. The where clause needs to use a field on the new table that is a reference to a one of the previous tables.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2024 11:54 AM
It is possible to add to a where clause with &&, but it sounds like it would be best to add the where clause on the custom table record - aws#=triggerid
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2024 07:46 AM
This is difficult to follow without a picture of the existing working Database View, and with at least one custom table, but generally you only want a left join if you want to include all of the records from one of tables even if it doesn't have a record on the other table in the join. The where clause needs to use a field on the new table that is a reference to a one of the previous tables.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2024 08:53 AM
I could just add all the records from the custom table and not limit it to just the field I need, so the left join would be sufficient. The problem is no field on the custom table is referenced in the other tables in the db view except that TriggerID field = AWS# in custom table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2024 10:12 AM
Here's a simple example with out of the box tables and fields.
This Database View will contain all fields from the incident and assessment instance tables. The assessment Trigger ID is the incident sys_id, so that is my Where clause. I want to see every incident, even the ones that do not have an assessment instance, so I have made this a left join.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2024 11:48 AM
So I already have the assessment instance table with a where clause for my other database view.
Could I add to the existing where clause?