Good day. I have a table with columns: year, item, count. Let's say I have the following rows in db table:
2007 item1 value1
2007 item2 value2
2008 item1 value3
2008 item2 value4
2009 item1 value5
2009 item2 value6
Is it possible with 1 query to have a result like this:
2007 value1 value2
2008 value3 value4
2009 value5 value6
I know how to group and so on, the problem is that the number of items could be different for each year, so, let's say we have 5 items total, I need the following output (if not found, add 0) :
2007 value1 value2 0 0 0
2008 0 value3 0 value4 0