title: How to read value with get readable and insert into another table with set writeable in the same function
body: <p>I need to read value with get readable and insert into another table with set writeable in the same function.</p>
  <pre><code>public void Check(String msg){
  
      //getdata from database
      String query=&quot;SELECT &quot;+ CUL_ID +&quot; FROM  &quot; + STUDENT_TABLE + &quot; WHERE &quot;+ CUL_QRCODE +&quot; like &quot;+ msg +&quot; &quot;;
      SQLiteDatabase db1=this.getReadableDatabase();
      db1.execSQL(query);
      db1.close();
  // I need to return this query in string variable value and put it into the queryString
  
      String value = &quot;&quot;;
      String queryString =&quot;INSERT INTO &quot; + TABLE_PRESENCE_TABLE + &quot; VALUES (&quot; + value + &quot; ,( SELECT count( &quot;+CUL_ID_PRESENCE+&quot; ) FROM  &quot; + TABLE_PRESENCE_TABLE + &quot; WHERE &quot;+ CUL_ID_PRESENCE+ &quot; = ( SELECT &quot;+ CUL_ID +&quot; FROM &quot;+ STUDENT_TABLE +&quot; WHERE &quot;+ CUL_QRCODE + &quot; = &quot;+ msg +&quot;))+&quot;+1+&quot; , datetime('now'));&quot;;
      SQLiteDatabase db = this.getWritableDatabase();
      db.execSQL(queryString);
      db.close();
  
  }
  </code></pre>