I have the following query that works as expected. I now want to sum the counts grouped by community type in the same query and cant get that part figured out.
[php]SELECT
c.community_type,
lt.lot_type_description,
Count(lot.lot_type_id) AS count
FROM
community AS c
INNER JOIN block AS b ON b.community_id = c.community_id
INNER JOIN lot ON lot.block_id = b.block_id
INNER JOIN lot_type AS lt ON lot.lot_type_id = lt.lot_type_id
WHERE
lot.lot_type_id <> 1
GROUP BY
c.community_type,
lt.lot_type_description
[/php]
CURRENT RESULT
[table]
[tr]
[td]community_type[/td]
[td]lot_description[/td]
[td]count[/td]
[/tr]
[tr]
[td]1[/td]
[td]Dried In[/td]
[td]1[/td]
[/tr]
[tr]
[td]1[/td]
[td]Slab[/td]
[td]3[/td]
[/tr]
[tr]
[td]2[/td]
[td]Slab[/td]
[td]1[/td]
[/tr][/table]
Result desired is something like:
[table]
[tr]
[td]community_type[/td]
[td]lot_description[/td]
[td]count[/td]
[td]SUM[/td]
[/tr]
[tr]
[td]1[/td]
[td]Dried In[/td]
[td]1[/td]
[td]4[/td]
[/tr]
[tr]
[td]1[/td]
[td]Slab[/td]
[td]3[/td]
[td]4[/td]
[/tr]
[tr]
[td]2[/td]
[td]Slab[/td]
[td]1[/td]
[td]1[/td]
[/tr]
[/table]