Jump to content
php.lv forumi

sql replace id with name from another table


Kaspars Ozols

Recommended Posts

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 by Kaspars Ozols
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...