[snip] Would anyone have a good idea on how to change rows to columns? I'm creating a report where I have counts per hour. I can produce +------+-------+ | hour | count | +------+-------+ | 0 | 1 | | 1 | 0 | | 2 | 1 | | 3 | 0 | | 4 | 0 |
And then tack on an additional column for each catagory I'm tracking. However, I want to turn this horizontal and tack on each catagory as a row. [/snip] Use a cross-tab query i.e SELECT SUM(IF(category1, 1, 0)) as "Category1", SUM(IF(category2, 1, 0)) as "Category2", SUM(IF(category3, 1, 0)) as "Category3" FROM table -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]