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 the physical storage length of timestamp data type?
I HAVE 500 ROW TO UPDATE I WOULD LIKE TO USE ROLLBACK ALONG WITH COMMIT.WHAT IS THE SYNTAX TO CODE COMMIT AND ROLLBACK FOR EVERY 100 ROWS.AND HOW THE CURSOR ROLLBACK TO THE LAST COMMITTING POINT.
How is deadlock resolved?
What are sqlcodes –803,-805, -811, -818,-904,-911,-913,-101, +100?
How to check last update on table in db2?
Are views updateable?
What is a trigger in the db2 database?
Mention the definition of cobol in varchar field.
What is db2 stogroup?
What is ibm db2 connect?
What are the 2 sqlcodes that are returned?
What is explain in db2?
Explain in brief how does db2 determine what lock-size to use?
How do you concatenate the firstname and lastname from emp table to give a complete name?
Which are the db2 tools to protect integrity of the database?