Here, I wrote a query using joins, the relation is fine, but I wanted display multiple columns from different tables which I used in joins, when I am trying to include or select other table columns it is performing cross join. Getting confused how to do add those columns which matches the conditions in joins. Can anyone please help me on this
select distinct p.*,ps.*,pp.*,pd.VERIFICATION_SUBJECT_ID,pd.VALUE
from Players p
join Players_Service ps on p.ID=ps.ID
join Players_Data pd on pd.VERIFICATION_SUBJECT_ID=ps.VERIFICATION_SUBJECT_ID
join Players_Property pp on pp.ID=ps.ID
Players table:
[{ID:1,NAME:'abc'}]
Players_Data table:
[{VERIFICATION_SUBJECT_ID:3, VALUE:'AB-TYS'},{VERIFICATION_SUBJECT_ID:4, VALUE:'AB-QE'}]
Players_Property:
[{ID:1,CITY:'XYZ',ID:2,CITY:'ABC'}]
Player_Service:
[{VERIFICATION_SUBJECT_ID:3,PLACE:'ABCDE'}]
Expected Output:
ID:1,
NAME:'abc',
VERIFICATION_SUBJECT_ID:3,
PLACE:'ABCDE',
CITY:'XYZ',
VALUE:'AB-TYS'