Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Fetching Data from table

Author  Topic 

bda.ajay
Starting Member

1 Post

Posted - 2011-07-26 : 03:56:02
i have a table in my data base as fallowed
Case Number----- Case Year------- Parawise_dt------Parawise_remark
1---------------------1999-------------01/07/2010--------Ex Remarks
2---------------------2010
3---------------------1999
4---------------------2010

i want out put as
case_year-----total_no_of_cases----no_of_parawise_remarks_filed
1999--------------2-------------------------1
2010--------------2-------------------------0

what should i write a query.

flamblaster
Constraint Violating Yak Guru

384 Posts

Posted - 2011-07-26 : 04:00:01
Not sure of your table structure, but maybe something like this:

Select CaseYear, count(CaseNumber) as total_no_of_cases, count(parawise_remark) as no_of_parawise_remarks_filed
From YourTable
group by caseyear
Go to Top of Page
   

- Advertisement -