KB-60507: Printing reports with homonym fields in different tables.

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:

SELECT  HistSala01.E3TimeStamp, HistSala01.On_Off as On_OffSala01, HistSala02.On_Off as On_OffSala02
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.

Attachments:

Report.zip

Print Friendly, PDF & Email

Este artigo foi útil? Was this helpful?

Classificação média - Average rating 0 / 5. Count: 0

Leave a Reply

Your email address will not be published.Required fields are marked *