Kaspars Ozols Posted March 4, 2019 Report Share Posted March 4, 2019 (edited) Palīdziet iesācējam ;) man ir Mysql tabula "kom" kurā ir ID un NAME un tabula "rez" kurā ir KOM_ID1, KOM_ID2, REZ1, REZ2 kā lai es izvadu visus "rez", bet "kom_id1", "kom_id2" ieliekot NAME no tabulas "kom" pašlaik rādās team1|team2|rez1|rez2 1|2|8|7 2|4|7|9 kā vajadzētu:team1|team2|rez1|rez2 Name1|Name2|8|7 Name2|Name4|7|9 SELECT * FROM rez WHERE someid=$id JOIN ? Edited March 4, 2019 by Kaspars Ozols Quote Link to comment Share on other sites More sharing options...
Val Posted March 4, 2019 Report Share Posted March 4, 2019 SELECT k1.NAME, k2.NAME, rez.REZ1, rez.REZ2 FROM rez INNER JOIN kom k1 ON k1.ID=rez.KOM_ID1 INNER JOIN kom k2 ON k2.ID=rez.KOM_ID2 Linku uz mysql manuāli jau atradi? Quote Link to comment Share on other sites More sharing options...
Kaspars Ozols Posted March 5, 2019 Author Report Share Posted March 5, 2019 (edited) Milzīgs paldies, viss strādā perfekti! Edited March 5, 2019 by Kaspars Ozols Quote Link to comment Share on other sites More sharing options...
Faks Posted March 5, 2019 Report Share Posted March 5, 2019 https://www.w3schools.com/sql/sql_join.asp gadijumā janu kādam noder :). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.