UNION
SELECT
CASE t.status WHEN 'closed' THEN 5 WHEN 'new' THEN 3 ELSE 1 END AS __color__,
(CASE t.status
WHEN 'closed' THEN 'color: #777; background: #ddd; border-color: #ccc;'
ELSE
(CASE t.owner WHEN $USER THEN 'font-weight: bold' END)
END) AS __style__,
t.milestone AS __group__,
'-' AS id,
'その他' AS 'ストーリー',
t.id AS ticket,
t.summary as 'タスク',
t.owner AS '担当者',
t.status AS '状態',
eh.value AS '見積',
th.value AS '作業時間',
''
FROM ticket as t
LEFT JOIN ticket_custom eh ON eh.ticket = t.id AND eh.name = 'estimatedhours'
LEFT JOIN ticket_custom th ON th.ticket = t.id AND th.name = 'totalhours'
WHERE t.type='タスク' AND
(SELECT count(*)==0 from subtickets WHERE subtickets.child = t.id)
ストーリーに紐づいていないタスクがバックログの確認画面で表示できません。 下記の記述をレポートに追加してください。