1. jaume
  2. Valentina Studio
  3. Friday, February 22 2019, 04:39 PM
  4.  Subscribe via email
Hello,

I wan to summarize some columns on report footer, so I add summary control on report footer.
the column that I wanto to summary is TOTAL_FACTURA, so summary is sum(TOTAL_FACTURA)

Sql expression to run this report is
select com_ivacompres.id as idx , com_ivacompres.*, sup_proveidors.* from com_ivacompres, sup_proveidors
Where id_proveidor = sup_proveidors.id

When I click on preview valentina throw this error :
17:38:13 Page 1: Error( 1060 ) 42S21: "Duplicate column name 'ID'"
17:38:13 Page 1: SELECT * ,TOTAL_FACTURA AS InternalReportField0 FROM ( select com_ivacompres.id as idx , com_ivacompres.*, sup_proveidors.* from com_ivacompres, sup_proveidors
Where id_proveidor = sup_proveidors.id) as foo

If I remove this summary control, report runs fine.

Whats wrong ?
Comment
There are no comments made yet.
Sergey Pashkov Accepted Answer
Hello,

When the summary control is used the source query is executed as a subquery.
Tables com_ivacompres and sup_proveidors both have column ID.
MySQL doesn't allow to have columns with the same name returned from the subquery, so this error is generated.
But you can list necessary fields manually and assign an alias if necessary.
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Studio
  3. # 1
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.