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

  • Home
  • SEARCH
  • 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 6242237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:55:04+00:00 2026-05-24T11:55:04+00:00

I have a request that return bad result and I can’t fix it,the calculation

  • 0

I have a request that return bad result and I can’t fix it,the calculation is wrong ,

My query:

select TIMEDIFF(a.CREATED,b.CREATED) 
from
(
  select changegroup.CREATED 
  from changegroup,changeitem,project,jiraissue
  where  changegroup.id=changeitem.groupid
  and field='Group'
  and oldString='Triage' 
  and jiraissue.id=changegroup.issueid 
  and project.id=jiraissue.project 
  and project.pname='Test'
  and jiraissue.CREATED between '2011-08-11 14:01:00' and  '2011-08-11 14:11:00'  
) a,
(
  select jiraissue.CREATED 
  from jiraissue ,changegroup,project
  where jiraissue.id=changegroup.issueid 
  and project.id=jiraissue.project 
  and project.pname='Test'
  and jiraissue.CREATED between '2011-08-11 14:01:00' and '2011-08-11 14:11:00' 
) b;

the result of the subquery1:

enter image description here

the result of the subquery2:

enter image description here

The Result of the query:

enter image description here

The Result wanted :

enter image description here

The relation between tables

enter image description here

thank you

  • 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-05-24T11:55:05+00:00Added an answer on May 24, 2026 at 11:55 am

    First of all I’d rewrite your query as follows, just to clearly show the connections between the tables in the query:

    select TIMEDIFF(a.created,b.created) 
    from
        (
            select g.created
            from   changegroup g
            join   changeitem ci on (ci.groupId = g.id)
            join   jiraissue ji on (ji.id = g.id)
            join   project p on (p.id = ji.project)
            where  ci.field = 'Group'
                   and ci.oldString = 'Triage' 
                   and p.pname = 'Test'
                   and ji.created between '2011-08-11 14:01:00' and  '2011-08-11 14:11:00'
        ) a
    join    (
            select ji.created
            from   jiraissue ji
            join   changegroup g on (g.issueid = ji.id)
            join   project p on (p.id = ji.project)
            where  p.pname = 'Test'
              and  ji.created between '2011-08-11 14:01:00' and '2011-08-11 14:11:00' 
        ) b;
    

    I think you are missing the link between two subqueries. It really depends on what you are trying to accomplish. If I understood you well, and you just want to calculate the time difference between jira issue creation date and the creation date the issue belongs to, following query should do the trick (more less, based on your query):

    select TIMEDIFF(a.created,b.created) 
    from
        (
            select g.created, g.id as groupid
            from   changegroup g
            join   changeitem ci on (ci.groupId = g.id)
            join   jiraissue ji on (ji.id = g.id)
            join   project p on (p.id = ji.project)
            where  ci.field = 'Group'
          and  ci.oldString = 'Triage' 
          and  p.pname = 'Test'
          and  ji.created between '2011-08-11 14:01:00' and  '2011-08-11 14:11:00'
        ) a
    left join   (
            select ji.created, g.id as groupid
            from   jiraissue ji
            join   changegroup g on (g.issueid = ji.id)
            join   project p on (p.id = ji.project)
            where  p.pname = 'Test'
              and  ji.created between '2011-08-11 14:01:00' and '2011-08-11 14:11:00' 
        ) b ON (a.groupid = b.groupid)
    

    Please specify in detail what are you trying to accomplish and maybe I could help more.

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

Sidebar

Related Questions

I have a web request that can take 30-90 seconds to complete in some
I have a report that should return something along the lines of SELECT brand,
I have an ajax call that returns a result in HTML. If the request
I have a request that returns a JSON object with a single property which
I have response stream from a ftp web request that returns binary file. I
Suppose we have the xhr 'POST' request that returns 'redirect' status code. In that
I have a django view that returns HTTP 301 on a curl request: grapefruit:~
I have a SOAP request that is known to work using a tool like,
Suppose that I have a request handler that accepts an argument: key And let
I have a client request that all times be displayed in Pacific Time Zone,

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.