Kolejność PHP / MySQL według kolumn w innej tabeli
Używam tego kodu SQL:
sql=" SELECT * FROM channel_did ";
$rs=mysql_query($sql,$pbx01_conn) or die(mysql_error());
$counter=0;
$display='';
while($result=mysql_fetch_array($rs))
{
$sql2="SELECT * from client where id = '".$result["client_id"]."' ";
$rs2=mysql_query($sql2,$pbx01_conn) or die(mysql_error());
$result2=mysql_fetch_array($rs2);
}
tak wchannel_did
stółclient_id
kolumna to liczba, a następnie szukam wclient
tabela, w której id równa sięchannel_id.client_id
jak mogę dostać listę (zchannel_did)
zamówić przezcompany
kolumna wclient
stół?
**channel_id**
id
did
client_id
**client**
id
name
company
so client.id = channel_did.client_id