title: SQLITE Query- To retrieve all versions between two versions?
body: <p>The sqlite table consists of attributes :</p>
  
  <pre><code>|Versions (TEXT)|
  | "2.73.8"      | 
  | "3.6.4 "      | 
  | "3.9.11"      | 
  
  </code></pre>
  
  <p>and so on..</p>
  
  <p>I want to retrieve all the versions from the table between two versions given  in the query. For instance: Between versions- 2.9.10 &amp; 3.7.10 .</p>
  
  <p>I could not find any sqlite function to query this directly. I used Substring (SUBSTR) to split to get individual digits which could then be compared to the one present in the table. I was successful in doing that but I could find a way to query to retrieve all versions between two version set.</p>
  
  <pre><code>create table prod(version varchar);
  
  insert into prod values('2.7.5');
  insert into prod values('2.7.4');
  insert into prod values('2.0.0');
  insert into prod values('22.73.55');
  insert into prod values('22.17.54');
  insert into prod values('22.10.06');
  insert into prod values('3.7.5');
  insert into prod values('3.4.5');
  insert into prod values('3.7.6');
  </code></pre>
  
  <p>Query to retrieve all versions below or equal to : "3.50.6" (using nested "case when" ):</p>
  
  <hr>
  
  <pre><code>
  SELECT * from prod
  Where version IN ( SELECT 
      CASE WHEN (CAST(substr(version,0,instr(version,'.')) as integer)=3)
           THEN 
              CASE WHEN (cast(SUBSTR(SUBSTR(version, INSTR(version, '.')),1,INSTR(SUBSTR(version, INSTR(version, '.') + 1), '.') - 1) as float)&lt; 0.50 )
                   THEN
                      version
                   ELSE
                      CASE WHEN (cast(SUBSTR(SUBSTR(version, INSTR(version, '.')),1,INSTR(SUBSTR(version, INSTR(version, '.') + 1), '.') - 1) as float)=0.50)
                           THEN
                               CASE WHEN (CAST(replace(version, rtrim(version, replace(version, '.', '')), '')AS INTEGER)&lt;=6)
                                    THEN version
  
  END  END END END FROM prod);
  
  </code></pre>
  
  <hr>
  
  <p>Kindly provide me a way to query to retrieve all versions in the table  between two sets of versions.</p>