I am trying to generate a query which returns results based on month.
For example: table1
Name Amount createDate
p1 100 01/01/2012
p1 50 02/01/2012
p1 200 03/01/2012
p3 100 04/01/2012
The query should return:
Name Jan Feb Mar April
p1 100 50 200 0
p2 0 0 0 100
Any suggestion or any idea of how to do it.
I am using db2 database.Sorry for missing the details
Something like this might work…
However, the date equality test may not pass muster. Like the others said, you’ll probably have to look up date functions and find the one that suits your needs.