我已经从表格详细信息中尝试了查询。我想选择像'gani'和'gani-1'这样的名字(xxxx和xxxx-1)
select a.name,a.age from detail a,detail b where a.name=b.name || '-1' order by a.name;
工作并返回名称“gani-1”但是,
select a.name,a.age from detail a,detail b where a.name|| '-1' =b.name order by a.name;
或
select a.name,a.age from detail a,detail b where b.name= a.name|| '-1' order by a.name;
无法正常工作(长时间连续加载)
我想要选择像“gani”和“gani-1”这样的名字。
提前致谢...
我试过了条件
select a.name,a.age from detail a,detail b where (a.name || '-1' = b.name or a.name = b.name||'-1')
返回两个名称所需的结果。
但是当我添加一些像他们应该特别年龄的条件时
(a.name || '-1' = b.name or a.name = b.name||'-1') and (a.age=25 and b.age=25)
不起作用......
答案 0 :(得分:0)
你试过吗
select a.name, a.age
from detail a, detail b
where a.name = b.name and
a.name like (a.name || '-1')
order by a.name;
答案 1 :(得分:0)
你可以试试这个
select a.name, a.age from detail a, detail b where substr(a.name,len(a.name)-2) = b.name