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 8184577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:33:09+00:00 2026-06-07T01:33:09+00:00

My sql query fetches list of bug fix verification for a firmware for e.g.

  • 0

My sql query fetches list of bug fix verification for a firmware for e.g. def-456 is a ticket which asks me to test firmware test on a product. def-456 has several sub-tasks where results are being recorded. Results are recorded as :id: abc-123, abc-124, abc-125 etc (as shown in table below). These corresponding id’s have “pass” or “fail” result. I need to calculate two values —->
1. Number of attempts : in following example number of attempts would be 3/5 , there are 3 pass and 2 fail (i.e. pass/pass+fail) , here i can use count() method however don’t know how to append “/5” and
2. 1st attempt success rate : in following example, abc-123 failed however abc-124 passed, abc-125 failed however abc-126 passed and abc-127 passed without any failure, means my success rate is : 1 out 3 (i.e. 1/3), how can I display these values in sql? this is bit tricky and I am not able to find logic for this.

Here is my data for def-456:

    value | id| 
    --------------
    fail | abc-123  
    pass | abc-124   
    fail | abc-125   
    pass | abc-126   
    pass | abc-127  

and here is o/p I am trying to display :

id   |   value | attempts| %for attempts  | 1st attempt
----------------------------------------------------
abc-123    fail |   3/5  | 60%              | 1/3
abc-124    pass |   3/5  | 60%              | 1/3
abc-125    fail |   3/5  | 60%              | 1/3
abc-126    pass |   3/5  | 60%              | 1/3
abc-127    pass |   3/5  | 60%              | 1/3
  • 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-07T01:33:10+00:00Added an answer on June 7, 2026 at 1:33 am

    I believe this is what you need:

    SELECT
        a.id,
        a.resolution,
        b.*
    FROM 
        Table1 a
    CROSS JOIN
        (
            SELECT
                CONCAT(SUM(aa.resolution = 'pass'), '/', COUNT(*)) AS attempts,
                CONCAT((SUM(aa.resolution = 'pass') / COUNT(*)) * 100, '%') AS percent_attempts,
                CONCAT(SUM(bb.mindate IS NOT NULL AND resolution = 'pass'), '/', SUM(resolution = 'pass')) AS first_attempt 
            FROM
                Table1 aa
            LEFT JOIN 
                (
                    SELECT 
                        MIN(`date`) AS mindate 
                    FROM 
                        Table1
                ) bb ON aa.`date` = bb.mindate
        ) b
    

    SQLFiddle Link

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my Java code I have embedded a SQL query which fetches data from
I have been asked in an interview to write a SQL query which fetches
I have a model which contains a link to sql query that fetches information
I am using MS-SQL and I am trying to write a query which fetches
I am trying to write a sql query which fetches all the tags related
SQL query which select the record from three tables and there is no relation
I have the following HQL query which works fine, however it returns a list
I have the following sql query that fetches images from an establishment table. The
I have a query that fetches the list of user IDs and their corresponding
SQL query: SELECT ArticleCategories.Title AS Category, Articles.Title, Articles.[Content], Articles.Date FROM ArticleCategories INNER JOIN Articles

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.