Kaspars Ozols Posted March 4, 2019 Report 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
Val Posted March 4, 2019 Report 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
Kaspars Ozols Posted March 5, 2019 Author Report Posted March 5, 2019 (edited) Milzīgs paldies, viss strādā perfekti! Edited March 5, 2019 by Kaspars Ozols Quote
Faks Posted March 5, 2019 Report Posted March 5, 2019 https://www.w3schools.com/sql/sql_join.asp gadijumā janu kādam noder :). Quote
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.