Note that there are some explanatory texts on larger screens.

plurals
  1. POSQL Query for this requirement
    text
    copied!<p>I have a sqlite DB with tables <code>sample</code> ,<code>surveytype</code> and <code>status</code> .All 3 tables primary key id is set as foreignkey to table 'Operation".Please see the scema in the following image</p> <p><img src="https://i.stack.imgur.com/nAZk9.png" alt="enter image description here"></p> <p>My <code>operation</code> table has hence values </p> <p><img src="https://i.stack.imgur.com/piyge.png" alt="enter image description here"></p> <p>and sample as</p> <p><img src="https://i.stack.imgur.com/NRHPb.png" alt="enter image description here"></p> <p>and status</p> <p><img src="https://i.stack.imgur.com/Cn85Y.png" alt="enter image description here"></p> <p>and survey type as</p> <p><img src="https://i.stack.imgur.com/3AUvj.png" alt="enter image description here"></p> <p><strong>REQUIRED</strong></p> <p>What i need to achieve is </p> <p><img src="https://i.stack.imgur.com/c2ZJp.png" alt="enter image description here"></p> <p>From the operation table get information of <strong>status id</strong> and show it for specific buildings for all survey types.</p> <p><strong>Tried</strong></p> <p>I found a way by which to loop via program getting all the sample ids and all survey typeids in and get individual statusids as</p> <pre><code>for all sampleid in sample table { for all statustypeid in statustype table { select statusid from operation where sampleid = 2 and surveytypeid=1 } } </code></pre> <p>Is there a better option by sql single query to generate the table with all the values</p> <p>Note : Using sqlite,for ios app </p>
 

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