Question:
How can I print a report using two homonym fields from different tables?
Solution:
The problem when generating this report comes from having two fields in the database with the same name. For example, see this field from two different tables:
HistSala01.On_Off
HistSala02. On_Off
When we try to add fields with the same name, the report will opt for only one of the tables, and this will be replicated in all fields.
To fix this, you must use two SQL query tools: INNER JOIN and ALIASES.
With INNER JOIN, you will be able to select all rows in both tables, as long as there are corresponding columns.
With ALIASES, you will be able to temporarily name a table in the database or a column in a table.
The SQL query code will look like this:
FROM HistSala01
INNER JOIN HistSala02
ON HistSala01.E3TimeStamp = HistSala02.E3TimeStamp
ORDER BY HistSala01.E3TimeStamp ASC
At the Data Field’s DataField property, insert the name that was given to the field.