Ich arbeite an einem Projekt mit Symfony2.8 und MySQL. Ich habe 4 Tabellen in meiner Datenbank, die Benutzer, Zitate, Artikel, Artikelquotes sind.Erweiterte SQL-Abfrage in Symfony2 Doktrin
Benutzertabelle
<html>
<body>
<table border="1">
<tr>
<th>user_id</th>
<th>name</th>
<th>age</th>
</tr>
<tr>
<td>7</td>
<td>Alex</td>
<td>20</td>
</tr>
<tr>
<td>8</td>
<td>John</td>
<td>30</td>
</tr>
</table>
</body>
</html>
zitiert Tabelle
<html>
<body>
<table border="1">
<tr>
<th>quote_id</th>
<th>user_id</th>
<th>reference</th>
</tr>
<tr>
<td>61</td>
<td>7</td>
<td>AE20</td>
</tr>
<tr>
<td>62</td>
<td>7</td>
<td>AE21</td>
</tr>
<tr>
<td>63</td>
<td>7</td>
<td>AE22</td>
</tr>
<tr>
<td>64</td>
<td>8</td>
<td>AE29</td>
</tr>
</table>
</body>
</html>
articlesquote
<html>
<body>
<table border="1">
<tr>
<th>id</th>
<th>quote_id</th>
<th>article_id</th>
<th>qte</th>
</tr>
<tr>
<td>58</td>
<td>61</td>
<td>2</td>
<td>7</td>
</tr>
<tr>
<td>59</td>
<td>62</td>
<td>3</td>
<td>8</td>
</tr>
<tr>
<td>60</td>
<td>63</td>
<td>1</td>
<td>9</td>
</tr>
<tr>
<td>61</td>
<td>63</td>
<td>2</td>
<td>10</td>
</tr>
</table>
</body>
</html>
Artikel Tisch
<html>
<body>
<table border="1">
<tr>
<th>article_id</th>
<th>name</th>
</tr>
<tr>
<td>1</td>
<td>article1</td>
</tr>
<tr>
<td>2</td>
<td>article2</td>
</tr>
<tr>
<td>3</td>
<td>article3</td>
</tr>
</table>
</body>
</html>
nun die Beziehung zwischen diesen Tabellen ist
Benutzer < --Ein-To-Many -> Zitat < --one-To-Many -> ArticlesQuote < --viele-To-One -> Artikel
ich mag Artikel erhalten, die 7 von quote_id
bestellt in allen Zitaten von Benutzernummer ist, würde ich gerne Artikel erhalten, die 63 der Benutzernummer 7
in Angebotsnummer ist danken Sie für die Unterstützung mich.
Sie danken es funktioniert !!! Was ist mit der ersten: Ich möchte Artikel, die in allen Zitaten von Benutzer Nummer 7 sind bestellt von quote_id – Mostafa
ersetzen 'und q.quote_id = 63' mit 'bestellen von q.quote_id'. das sollte es tun. – jonju
danke mein Freund – Mostafa