{50} Active Tickets - gruppiert nach Meilenstein - mit Filter auf Ticketstatus für Wiki-Shortcut

Report execution failed:
OperationalError: ambiguous column name: description

SELECT COUNT(*) FROM (

SELECT __color__, __group__, __style__,  ticket, summary, component, type,
  priority, severity, __milestone__, status, owner as "Verantw.", Estimated_work as "Aufwand h", 
--round(Total_work / 8, 1) as 'Done AT', 
  _ord, __prio__, __severity__

FROM (
SELECT p.value AS __color__,
       t.milestone AS __group__,
       '' as __style__,
       t.id AS ticket, summary AS summary,             -- ## Break line here
       t.type as type,
       component,priority, severity, milestone as __milestone__, status, owner,
       p.value as __prio__,
       s.value as __severity__,
       CASE WHEN EstimatedHours.value = '' OR EstimatedHours.value IS NULL THEN 0
         ELSE CAST( EstimatedHours.value AS DECIMAL ) END as Estimated_work,
       CASE WHEN totalhours.value = '' OR totalhours.value IS NULL THEN 0
         ELSE CAST( totalhours.value AS DECIMAL ) END as Total_work,
       time AS created, changetime AS modified,         -- ## Dates are formatted
       description AS _description_,                    -- ## Uses a full row
       changetime AS _changetime,
       reporter AS _reporter, 
       0 as _ord -- als Sortiermerkmal der beiden Selects im union (Daten vor Summe)

  FROM ticket as t
  LEFT JOIN enum as p ON p.name=t.priority AND p.type='priority'
  LEFT JOIN enum as s ON s.name=t.severity AND s.type='severity'

LEFT JOIN ticket_custom as EstimatedHours ON EstimatedHours.name='estimatedhours'
      AND EstimatedHours.Ticket = t.Id
LEFT JOIN ticket_custom as totalhours ON totalhours.name='totalhours'
      AND totalhours.Ticket = t.Id

  WHERE (t.status <> 'closed') and (t.status not in (%s, %s) )

UNION

SELECT '1' AS __color__,
       t.milestone AS __group__,
       'background-color:#DFE;' as __style__,
       count(t.id) as ticket, 
       --NULL as ticket, 
       'Tickets' AS summary,
       'Total work:' as component, NULL as priority, NULL as severity,
       t.type as type,
       t.milestone as  __milestone__, 'Time Remaining: ' as status,
       NULL as __prio__, NULL as __severity__,
       CAST(
       SUM(CASE WHEN EstimatedHours.value = '' OR EstimatedHours.value IS NULL THEN 0
         ELSE CAST( EstimatedHours.value AS DECIMAL ) END) -
       SUM(CASE WHEN totalhours.value = '' OR totalhours.value IS NULL THEN 0
         ELSE CAST( totalhours.value AS DECIMAL ) END)
         AS CHAR(512)) as owner,
       SUM(CASE WHEN EstimatedHours.value = '' OR EstimatedHours.value IS NULL THEN 0
         ELSE CAST( EstimatedHours.value AS DECIMAL ) END) as Estimated_work,
       SUM(CASE WHEN totalhours.value = '' OR totalhours.value IS NULL THEN 0
         ELSE CAST( totalhours.value AS DECIMAL ) END) as Total_work,
       NULL as created, NULL as modified,         -- ## Dates are formatted

       NULL AS _description_,
       NULL AS _changetime,
       NULL AS _reporter
       ,1 as _ord
  FROM ticket as t
  JOIN enum as p ON p.name=t.priority AND p.type='priority'

LEFT JOIN ticket_custom as EstimatedHours ON EstimatedHours.name='estimatedhours'
      AND EstimatedHours.Ticket = t.Id

LEFT JOIN ticket_custom as totalhours ON totalhours.name='totalhours'
      AND totalhours.Ticket = t.Id

  WHERE t.status <> 'closed'

  GROUP BY t.milestone
)  as tbl

--ORDER BY __milestone__, _ord ASC, ticket
ORDER BY __milestone__, _ord ASC, __prio__, __severity__, ticket

--ORDER BY __milestone__, priority

) AS tab
Note: See TracReports for help on using and creating reports.