Hi all,
I would like to build a query that shows as many columns as I need. I'm looking 
for it and didn't find any answer.
Could anyone help me?

The problem is the following

I have the Main table:

id        month        value            type
1            jan            30                1
2            jan            10                2
3            jan            15                2
4            fev            20                1
5            fev            15                3
6            fev            10                1
7            fev            40                3
8            mar           15                2
9            mar           10                1
10          mar           20                3

And the table Types:

id        name    
1        lunch
2        bus
3        shopping

And I want my query to show the sum of each type in each month, like this:

month        lunch        bus        shopping
jan                30          25                0
fev                30            0               40
mar               10          15               20

But the query has to show as many columns as the table Types have.
That is, if I add columns to the table types I don't want to modify the query.

Could anyone help me?



      Veja quais são os assuntos do momento no Yahoo! +Buscados
http://br.maisbuscados.yahoo.com

[Non-text portions of this message have been removed]

Reply via email to