sql question

  • Thread starter Thread starter Aleks
  • Start date Start date
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
 
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
 
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
 
Back
Top