The leader in industrial automation and control solutions

Applicable Model(s)

EBPro

Title

Joining SQL Tables with Advanced Mode

Date

05/01/2025

Rev

00

P/N

TN5159

Summary

This technical note explains how to join two database tables using EBPro’s SQL Advanced Mode and store the results in a new table for viewing. It explains how to issue commands to combine data and visualize the output using EBPro’s SQL tools. This method supports better organization and access to related information across multiple sources.

NOTE: Advanced Mode cannot be disabled after being enabled.


Solution

Enabling advanced mode

NOTE: Advanced Mode is not able to be disable once enabled. If it is a new project, then you must first create a Database server and ensure connection can be established.

1.

Open existing project, or create a new project and navigate to Data/History tab and click on SQL Query.

2.

Create a new SQL query.

3.

Enable Advanced Mode.

4.

Click “Yes” to continue in Advanced Mode.

Screenshot of EBPro SQL Query menu

Define a Command ID, and SQL syntax

NOTE: One column is required to create a table. maple.first_table, and maple.second_table were already created in the maple database, with said columns. Replace this with the relevant information in your database.

1.

Click on the “Command” tab inside the SQL Query dialog menu.

2.

Click “New” to instantiate a new SQL Query Command.

Screenshot of EBPro SQL Query menu

3.

Give the Command ID a unique value, and a description of what the command will do.

4.

Inside the SQL Query section place the following information or adjust it accordingly to the project file.

Screenshot of SQL Query code

Testing

1.

Create a new SQL Command that will read maple.combine.

2.

Syntax for reading maple.combine is the following:

SELECT * from maple.combine

3.

Exit out of SQL Query dialog menu(s).

4.

Under Data/History tab click SQL Query Result Viewer and place it on a Window.

Screenshot of EBPro ribbon menu

5.

Under the Project tab click Numerical Object and place it on the window.

6.

Configure the Numerical Object to read/write to the SQL Query Control LW address.

Screenshot of SQL Query menu
Screenshot of Numeric Object properties

7.

Run an Online or Offline simulation.

8.

Send the Command ID value of the first SQL Query command to the Numerical Object. This is to create the table if it does not exist, and add columns “id, table_one_data, and table_two_data” to it.

Screenshot of SQL Query menu

9.

Send the Command ID value of the second SQL Query command to the Numerical Object. This is so the SQL Query Result Viewer can display the contents of maple.combine.

Screenshot of SQL Query menu

10.

SQL Query Result Viewer should present the combined information.

Screenshot of SQL data displayed in EBPro