1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[SQL] Returning wrong ans [closed]

Discussão em 'Outras Linguagens' iniciado por Stack, Setembro 18, 2025.

  1. Stack

    Stack Membro Participativo

    This is my query for the sql question from the sql 50 the question number is 1661.

    select a.machine_id, round(avg(b.timestamp - a.timestamp),3) as processing_time
    from Activity a
    inner join Activity b
    on a.process_id = b.process_id
    and a.machine_id = b.machine_id
    and a.timestamp < b.timestamp
    group by machine_id;


    and this is not accepted. It worked for the 7 testcases but on the 8th one the output first output not matches but the remaining outputs are correct how its possible as well this next code works fine and passes all the test cases can any body help me in understanding this

    SELECT a.machine_id,
    ROUND(AVG(b.timestamp - a.timestamp), 3) AS processing_time
    FROM Activity a,
    Activity b
    WHERE
    a.machine_id = b.machine_id
    AND
    a.process_id = b.process_id
    AND
    a.activity_type = 'start'
    AND
    b.activity_type = 'end'
    GROUP BY machine_id;

    Continue reading...

Compartilhe esta Página