データベースビューのテーブル結合

tokuyamaharuyuk
Kilo Guru

データベースビューより、4つのテーブルを結合したい
設定、where句の記述がわからない(Where句が理解できていないです。)
対象テーブル
task、incident、change_request、problem
(2つはできた。task、incident)
4つは? できるのか?

 

1 ACCEPTED SOLUTION

Got it, so you can create a database view like this,

o join all the four you may need to create 3 records in view tables related records for a database view record. Keeping task as base you can join with other table.
task with incident : task_sys_id=incident_sys_id
task with problem: task_sys_id=problem_sys_id
task with change : task_sys_id = change_sys_id

View solution in original post

5 REPLIES 5

Shishir
Mega Guru

To join all the four you may need to create 3 records in view tables related records for a database view record. Keeping Incident as base you can join with other table.
task with incident : task_sys_id=incident_sys_id
incident with problem: incident_problem_id=problem_sys_id
incident with change : incident_rfc = change_sys_id

For above conditions to work prefix for incident table is incident, change table is change and problem table is problem. Let me know if it helps 

Shishirさん 返信 ありがとうございます。

 うまく、条件を説明できてなくて、すいません。  条件は以下になります。

incidentと繋がりのないchangeとproblemもマージしたいです。(すべて)
イメージは、
Where task_number = incident_number || task_number = change_number || task_number = problem_number

incident、change、problemのそれぞれに、カスタムフィールドがあり、
タスクテーブルに結合して、1つのテーブルを作成したいです。
(レポート機能でグラフを作成するため)

Since you want to merge change, problem ,incident and task then in that case you dont even have to create a database view.

 

Task table is parent of Incident, Problem and change, so all you have to do is , open task table and put filter that Number starts with  INC OR CHG OR PRB and you will get your result.

Let me know if it helps.

変更、問題、インシデントにカスタムフィールドを追加
タスクには追加していない。
上記の状況です。

しかし、

1つのテーブルとして、カスタムフィールドも含めて表示したい。
task_number = Incident_number || task_number = change_number || task_number = problem_number