SQL query - add table name before column name
When we add a ODBC data connection and choose for "Add SQL query" and enter a query with multiple tables the result is a list of columns of all these tables. But without the name of the table it is very hard to see easily what column you need. I know we could alias all the columns but when you have to aliasses dozens of columns per report it is a LOT of work.
Please, please, please, could you modify this. It will help is very very much.
I will explain it by a small example (simplified):
query:
SELECT * FROM orders INNER JOIN orderlines INNER JOIN articles;
That query results in a list of columns, for example:
number
date
customer
.
.
number1
articleno
quantity
price
.
.
number2
description
What we need is that the query returns the table name before the column name delimited by a underscore, for example:
orders_number
orders_date
orders_customer
.
.
orderlines_number
orderines_articleno
orderlines_quantity
orderlines_price
.
.
article_number
article_description
Please, please, please, could you modify this. It will help is very very much.
I will explain it by a small example (simplified):
query:
SELECT * FROM orders INNER JOIN orderlines INNER JOIN articles;
That query results in a list of columns, for example:
number
date
customer
.
.
number1
articleno
quantity
price
.
.
number2
description
What we need is that the query returns the table name before the column name delimited by a underscore, for example:
orders_number
orders_date
orders_customer
.
.
orderlines_number
orderines_articleno
orderlines_quantity
orderlines_price
.
.
article_number
article_description