Android 開発でsqliteのselect文に可変変数で抽出する方法

Android 開発で、sqlite(DB)を使用することがあります。
抽出時(select命令)、検索条件を検索の都度変更したいときがあります。
select命令で、可変変数を使用する際の方法をまとめました。

Wtabel・・・テーブル名
Wtime・・・何かしらの条件で設定した時刻

1String Wtabel;
2String Wtime;
3 
4 
5Wtabel = "xxxdb";
6 
7if (xxxxxxx < xxxx){
8    Wtime = "1234";
9 }else{
10    Wtime = "1456";
11 
12}
13 
14String qry = "SELECT time,ride,ikisaki from " + Wtabel + " where time >= '" + Wtime + "' order by time";
Verified by MonsterInsights