Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is reorg and runstats in db2?

1213


Following a db2 update statement, what is the quickest way to compute the total number of updated rows?

1062


How can tablespace be moved to another dasd volume that is allocated for that tablespace?

1235


What is coalesce in db2?

1129


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?

8279


What is db2 connect?

1064


What is schema in db2?

1018


What is iseries database?

1046


What is cloudant database?

1095


What is a storage group (stogroup)?

1241


What is the purpose of rollback and commit?

1190


What is database manager in db2?

1017


How many databases can be created inside an instance in db2 ?

1031


Explain the benefits you can get from mainframe connect?

970


How to find the number of rows in db2 tables?

1065