Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8144909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:30:13+00:00 2026-06-06T13:30:13+00:00

Here is original Query :, it generates o/p with two columns name (label, count)

  • 0

Here is original Query :, it generates o/p with two columns name (label, count) :

label      count 
Fails      1
Pass       3

and here is query I wrote which generates above data

select r.pname as resolution
,lb.label
,count(r.pname) as occurences
from issuelink
inner join jiraissue p on issuelink.source = p.id
inner join jiraissue c on issuelink.destination = c.id
inner join issuelinktype t on issuelink.linktype = t.id
inner join resolution r on c.resolution = r.id
inner join issuestatus istat on p.issuestatus = istat.sequence
inner join label lb on c.id = lb.issue
where t.linkname = 'jira_subtask_link'
and p.pkey in (@pkey)
and c.issuetype in ('13')
and r.pname not in ('Fails Smoke Test - General Failure', 'Fails Smoke Test - New Firmware Available')
and label in ('SmokeTest', 'fullcert', 'bfv', 'papercert')
group by r.pname;

As per your suggestion I tried using cross function, however its throwing an error of “please check syntax”:

select  100.0 * fail.cnt / (fail.cnt + pass.cnt) as c
from    (
        select  r.pname as label
        ,       count(r.pname) as cnt
        from issuelink
        inner join jiraissue p on issuelink.source = p.id
        inner join jiraissue c on issuelink.destination = c.id
        inner join issuelinktype t on issuelink.linktype = t.id
        inner join resolution r on c.resolution = r.id
        inner join issuestatus istat on p.issuestatus = istat.sequence
        inner join label lb on c.id = lb.issue
        where t.linkname = 'jira_subtask_link'
        and p.pkey in ('SRPDTVTPV-3')
        and c.issuetype in ('13')
        and r.pname not in ('Fails Smoke Test - General Failure', 'Fails Smoke Test - New Firmware Available')
        and label in ('SmokeTest', 'fullcert', 'bfv', 'papercert')
        group by r.pname
        ) as fail
cross join    
        (
        select  r.pname as label
        ,       count(r.pname) as cnt
        from issuelink
        inner join jiraissue p on issuelink.source = p.id
        inner join jiraissue c on issuelink.destination = c.id
        inner join issuelinktype t on issuelink.linktype = t.id
        inner join resolution r on c.resolution = r.id
        inner join issuestatus istat on p.issuestatus = istat.sequence
        inner join label lb on c.id = lb.issue
        where t.linkname = 'jira_subtask_link'
        and p.pkey in ('SRPDTVTPV-3')
        and c.issuetype in ('13')
        and r.pname not in ('Fails Smoke Test - General Failure', 'Fails Smoke Test - New Firmware Available')
        and label in ('SmokeTest', 'fullcert', 'bfv', 'papercert')

        group by r.pname
        ) as pass
where   fail.label = 'Fails Certification'
        and pass.label = 'Passes Certification'
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T13:30:14+00:00Added an answer on June 6, 2026 at 1:30 pm

    Here’s one way using a cross join:

    select  100.0 * a.count / (a.count + b.count) as c
    from    YourQuery a
    cross join    
            YourQuery b
    where   a.label = 'a'
            and b.label = 'b'
    

    Here’s another approach using aggregates, a bit more tricky but only uses YourQuery once:

    select  100.0 * cnt_a / (cnt_a + cnt_b) as c
    from    (
            select  max(case when label = 'a' then count end) as cnt_a
            ,       max(case when label = 'b' then count end) as cnt_b
            from    YourQuery
            ) as SubQueryAlias
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok, here was my original question; Table one contains ID|Name 1 Mary 2 John
I'm trying to parallelize a convolution function in C. Here's the original function which
My original question can be found here , for which I've gotten some great
Here's the situation I'm dealing with. The original query I had was: SELECT c.CustID,
I wrote a data.stackexchange query to find out what hour of the day a
So here is the original query SELECT SUM(PickQty), SUM(ReqQty), AssignmentID, StopID FROM PickRequest GROUP
I am working on a search/tag system. My original query I wrote was for
Here is my original query... SELECT `id` FROM `properties` LIMIT 10, 20 The LIMIT
Refer original post here for a reference to the original issue. What plugin should
here is the original code: public static int getInt () { Scanner in =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.