Joining tables using database views
Join tables into a single view and then create a report based on that view.
Use the Database Views module to create a database view that joins tables to create a pseudo-table that combines data from each table in the view. You can create a report on this data by adding the database view as a table in a report. Accessing the database view does not require database access.
- Create a database view
Create the database view. - Add a table to the database view
Specify the table to join to the database view. - Example left join in creating a database view
This example shows the proper settings when using left-joins to add tables to a database view. - Specify a field to return
Restrict or specify a field that you want returned by the joined table. - Relabel a column
Sometimes, two different tables may have fields of the same name that are both important (such as two tables with a sys_updated_on field). For clarity, relabel one of the fields. - Configuring the number of records to return
Specify the number of records to return for a database view when the view is used in a script. - Test the database view
Verify that the database view works correctly.
Parent Topic:Working with database views for reporting
Related topics
Displaying function results in a database view