Re: [sqlite] GROUP BY on SUM CASE

2013-11-13 Thread Igor Tandetnik
On 11/13/2013 9:51 AM, g.costa...@email.it wrote: I've this SELECT ... GROUP BY order_details.order_detail_id How I can group by order_id? "GROUP BY orders.order_id", I suppose. What exactly is the nature of the problem? -- Igor Tandetnik ___

Re: [sqlite] GROUP BY on SUM CASE

2013-11-13 Thread Simon Slavin
On 13 Nov 2013, at 2:51pm, g.costa...@email.it wrote: > I've this First, I can't read your post, it has too much HTML mixed up in it. Second, anything this complicated should probably be done in software, not by trying to use features of SQL. Simon.

[sqlite] GROUP BY on SUM CASE

2013-11-13 Thread g . costanzi
hi, I've this SELECT orders.order_id AS order_id, strftime('%d-%m-%Y', orders.issued) AS issued, suppliers.company AS company, departments.department_id AS dep_id, order_details.quantity AS qty, SUM(CASE WHEN transactions.category_id = 1 THEN 1 ELSE 0 END) AS dispatch,