SQL query returns duplicated and error value

Asked

Viewed 39 times

0

I have the following query but it is returning duplicate and wrong results. Arthur should show 0 and not 30.inserir a descrição da imagem aqui

  • please put the code here and not printscreen.

  • Your query is without any Where?...

  • 1

    you have no condition in the joins

1 answer

1

I’ve come to the conclusion of how you do:

SELECT Player_name, Subscription_id,Date_subscription,Amount_paid,Attendance_id,Training_date
FROM PLAYER p,SUBSCRIPTION s, Attendance a
WHERE p.SUBSCRIPTION_SUBSCRIPTION_ID = s.SUBSCRIPTION_ID and a.PLAYER_PLAYER_ID = p.PLAYER_ID;
  • That’s right, Diana; the junctions had to be established. Thiago and Rovann had already sung to stone. // Tip: establish the junctions using the ON clause. Leave only the filters for the WHERE clause. This facilitates further understanding and maintenance.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.