sql question

A

Aleks

I am trying to combine two sql statements to get just one result, right now
I have:

SELECT Count (ActivityId) AS ActTotNum
FROM dbo.Activities
WHERE CaseId = MMColParam and ActType ='HISTORY'

Which gives result: ActTotNum = 14

SELECT Count (ActivityId) AS ActCompleted
FROM dbo.Activities
WHERE CaseId = MMColParam and ActType ='HISTORY'AND (a.Lastmodified IS NOT
NULL AND a.Dateinitiated IS NULL)

Which gives result: ActCompleted = 4

I need one statements that gives me: 4/14, that is ActCompleted / ActTotNum

How can I do this ?

Help is greately appreciated.

Aleks
 
L

liuli

Aleks said:
I am trying to combine two sql statements to get just one result, right now
I have:

SELECT Count (ActivityId) AS ActTotNum
FROM dbo.Activities
WHERE CaseId = MMColParam and ActType ='HISTORY'

Which gives result: ActTotNum = 14

SELECT Count (ActivityId) AS ActCompleted
FROM dbo.Activities
WHERE CaseId = MMColParam and ActType ='HISTORY'AND (a.Lastmodified IS NOT
NULL AND a.Dateinitiated IS NULL)

Which gives result: ActCompleted = 4

I need one statements that gives me: 4/14, that is ActCompleted / ActTotNum

How can I do this ?

Help is greately appreciated.

Aleks
 
V

Vadim Rapp

Hello Aleks:
You wrote on Tue, 19 Oct 2004 18:30:33 -0400:

A> I am trying to combine two sql statements to get just one result, right
A> now I have:

select acttnum,actcompleted from (<1st select atetement>) t1 cross join
(<2nd select statement>)

then apply right CAST and concatenation to get actnum / actcompleted.

Vadim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top