我无法从数据库读取数据。有人可以帮我写一个适合我的查询吗?
Select name1,name2
if (name2 start with "abcd" or "bcda" or "dasd" then skip 4 first Characters )
From TableName
where name2 like 'Input'
让我们瞥见一个问题:我想获取name2的数据。类似于“输入”的数据,但是首先我要检查name2是否以“ abcd”开头,那么我不想显示name2的前4个字符。
编辑:我忘了我应该检查2个不同的参数,然后添加或,并且我正在为android开发应用程序并使用SQlite。
我希望我能清楚地解释它,对不起我的英语。
编辑2:我的代码还有问题。它不能很好地显示前4个字母,但问题是它返回这前4个字母。此代码是单词词典的搜索部分。我附上一张照片让你看清楚。 all of these words started with 'das ' and I don't want to show them because I filtered it with below code .
c = mydb.rawQuery("select dId,case when substr(dWord,1,4) in ('das ','der ','die ') then substr(dWord,5,length(dWord) - 4)else dWord end as dWord from german where dWord like '%"+search+"%'",null);