db2 query
I have one table with the following details.
SNO SNAME DOJ
------ -------------------- ----------
10 KRISH 2007-03-19
20 REDDY 2007-05-19
30 RRRRR 2007-05-19
40 BBBBB 2008-05-19
50 CCCCC 2009-05-19
60 JJJJJ 2009-05-19
70 JJJJJ 2004-05-19
i want the output in the following format:( no of students
joined in each year(no nedd to consider about month and
date)
year count
--------- ----------
2004 1
2007 3
2008 1
2009 2
Answer Posted / rama krishna reddy
Hi Amita,
i already tried with the query that you mentioned..
it will work in oracle...but it will not work in db2..
db2 doesn't allow any function like year(),month(),substr
()...in group by clause...
| Is This Answer Correct ? | 1 Yes | 2 No |
Post New Answer View All Answers
What is reorg and runstats in db2?
Following a db2 update statement, what is the quickest way to compute the total number of updated rows?
How can tablespace be moved to another dasd volume that is allocated for that tablespace?
What is coalesce in db2?
Suppose pgm A calling Pgm B .Pgm B has some Db2 program. at the time of compilation should plan and package will be created for both A and B or only B? What is the concept?
What is db2 connect?
What is schema in db2?
What is iseries database?
What is cloudant database?
What is a storage group (stogroup)?
What is the purpose of rollback and commit?
What is database manager in db2?
How many databases can be created inside an instance in db2 ?
Explain the benefits you can get from mainframe connect?
How to find the number of rows in db2 tables?