Loading...
 
Skip to main content

Features / Usability


You are viewing a reply to PluginDBreport error

Re: Re: PluginDBreport error

Ok, I think this is the solution. The SQL command returns the column/field names as they exist in their respective tables. If you have two fields with the same name in two different tables, they will both have the same name in the returned data. The trick is to use the the AS parameter in the SELECT statement. This allows you to rename the field to something unique.

Copy to clipboard
SQL { SELECT `projects`.`name` AS `project name`,`projects`.`description`,`projects`.`state`, `todos`.`name`,`todos`.`description`,`todos`.`due`,`todos`.`state` FROM `projects`,`todos` WHERE `todos`.`project_id` = `projects`.`id` } GROUP [project name] "[project name]":H1

Here I have told it to return the field projects.name as "project name" instead of "name" so it is not confused with todos.name, which would also have been returned as "name".
Then, in the GROUP parameter, I can use "project name" instead of "name".