i'm really new at this and have the following question. say I have this table:
CREATE TABLE `transactions` (
`date` date DEFAULT NULL,
`category` enum('gas','food') DEFAULT NULL,
`cost` float(10,2) DEFAULT NULL
) ENGINE=MyISAM;
with these inserts:
INSERT INTO `transactions` (`date`,`category`,`cost`) VALUES ('2010-09-01','food','20.00');
INSERT INTO `transactions` (`date`,`category`,`cost`) VALUES ('2010-09-10','gas','10.00');
INSERT INTO `transactions` (`date`,`category`,`cost`) VALUES ('2010-09-15','food','40.00');
INSERT INTO `transactions` (`date`,`category`,`cost`) VALUES ('2010-08-20','food','35.00');
producing a table that would look like this:
date category cost
2010-09-01 food 20.00
2010-09-10 gas 10.00
2010-09-15 food 40.00
2010-08-20 food 35.00
i'm able to query to produce these two tables:
item august
food 35.00
item septemper
gas 10.00
food 60.00
but I would like to query to combine them and include zeros where relevant. i.e. i would like to produce a table like this:
item august septemper
gas 0.00 10.00
food 35.00 60.00
any suggestions? thanks!