472,119 Members | 1,467 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,119 software developers and data experts.

Simple SQL help

SELECT COUNT(ID) AS TotalSupportIsses
FROM jirauser.jiraissue
WHERE (issuetype = '5') AND (issuestatus <> '6')

SELECT COUNT(ID) AS TotalCustomers
FROM jirauser.project
WHERE (pname LIKE 'Support%') AND (pname <> 'Support: Internal')

I need to divide the value of the first by the value of the second. So the first query returns 5 and the second query returns 10 so I need my stored proc to do 5/10.
Oct 26 '06 #1
1 1229
Try this:

DECLARE @CountID1 FLOAT
DECLARE @CountID2 FLOAT
DECLARE @Answer FLOAT

SELECT @CountID1=COUNT(ID)
FROM jirauser.jiraissue
WHERE (issuetype = '5') AND (issuestatus <> '6')

SELECT @CountID2=COUNT(ID)
FROM jirauser.project
WHERE (pname LIKE 'Support%') AND (pname <> 'Support: Internal')

SET @Answer=@CountID1/@CountID2

PRINT @Answer
Oct 27 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Patchwork | last post: by
reply views Thread by unixman | last post: by
17 posts views Thread by savesdeday | last post: by
2 posts views Thread by Don Wash | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.