Simple SQL help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • alpha05
    New Member
    • Oct 2006
    • 1

    #1

    Simple SQL help

    SELECT COUNT(ID) AS TotalSupportIss es
    FROM jirauser.jirais sue
    WHERE (issuetype = '5') AND (issuestatus <> '6')

    SELECT COUNT(ID) AS TotalCustomers
    FROM jirauser.projec t
    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.
  • zierde01
    New Member
    • Oct 2006
    • 3

    #2
    Try this:

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

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

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

    SET @Answer=@CountI D1/@CountID2

    PRINT @Answer

    Comment

    Working...