seçme sorgusu sorunu mysql

0 Cevap php

Task 1

First i have a specific user, I want to see with which user it is connected to. lets say alex in following table. I want to check if alex is connected to another user? In following table it is connected with John and christina, so i select john and christina.

Task 2

Şimdi başka bir kullanıcı var. Ben martin ile bağlantılı önceki seçilen kullanıcılar (john ve Christina) hangi görmek istiyorum, martin diyelim.

ID  user1      user2   status
1   alex       john      1
2   john       martin    1
3   Jane       smith     1
4   smith      john      1
5   christina  alex      1

Örneğin, yukarıdaki tabloda:

People who are connected to alex are john and christina. We want to check which of the users (john and christina) are connected with martin. and the result should be row2.


Teşekkürler cevaplar için herkes. Hepiniz onunla yanlış ne olduğunu bana söyler misin, veritabanı tasarımı iyi değil söz edilir. İşte benim kullanıcı tablo:

Table1 usersID username and here is Table2. user_connections

ConnectionID     user1_ID     user_Connectedto

Whats yanlış söyle ve nasıl ben artırabilir lütfen?

0 Cevap