Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It looks telcoId is primary unique in telco table, but can be multiple in other tables (which makes sense), unfortunately if you try to join single (1) to multiple1 (2) to multiple2 (2) to multiple3 (3), it'd create 1 * 2 * 2 * 3 = 12 rows, which explains the messy multiple2 and multiple3.</p> <p>So instead of doing that single DB call, you'll be looking at less efficiency by running separate queries, getting the telco info first, then making individual DB calls for each telco on telcoCall, telcoData, telcoSMS.</p> <p>Or if you just want the speed and don't care about clean code, you can just use what you have right now, but stack up the if conditions:</p> <p>EDIT 1: Edited to fix logic flaw, for some reason Gaussian elimination comes to mind</p> <pre><code>// Stacking order determined by your SQL ORDER BY: t.telcoName, c.callName, d.dataName, s.smsName if($telcoId == $row['telcoId']) continue; //telco stuff... if($callId == $row['callId']) continue; //call stuff... if($dataId == $row['dataId']) continue; //data stuff... if($smsId == $row['smsId']) continue; //sms stuff... </code></pre> <p>EDIT 2: Another slower way that requires less brainwork</p> <pre><code>if($telcoId != $row['telcoId']) { //telco stuff... callArrayTemp = array(); dataArrayTemp = array(); smsArrayTemp = array(); } if(!in_array($row['callId'], callArrayTemp[])) { callArrayTemp[] = $row['callId']; //call stuff... } if(!in_array($row['dataId'], dataArrayTemp[])) { dataArrayTemp[] = $row['dataId']; //data stuff... } if(!in_array($row['smsId'], smsArrayTemp[])) { smsArrayTemp[] = $row['smsId']; //sms stuff... } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload