首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

如何删除查询出来的反向数据

2012-03-13 
怎么删除查询出来的反向数据?sqlstr:select * from TempPljxKx where (Pzh like %+EdtSearch.text+%

怎么删除查询出来的反向数据?
sqlstr:='select * from TempPljxKx where (Pzh like ''%'+EdtSearch.text+'%'' or bz like ''%'+EdtSearch.text+'%'')';



我用上面的模糊查询语句可以查出想要的数据,那么我要将其他没有查询出来的数据删除要怎么写呢?

[解决办法]
sqlstr := 'delete from temppljxkx where id not in (select id from TempPljxKx where (Pzh like ''%'+EdtSearch.text+'%'' or bz like ''%'+EdtSearch.text+'%''))'
[解决办法]
sqlstr:='delete from TempPljxKx where not ((Pzh like ''%'+EdtSearch.text+'%'' or bz like ''%'+EdtSearch.text+'%''))';
[解决办法]

Delphi(Pascal) code
sqlstr:='delete from TempPljxKx where not (Pzh like ''%'+EdtSearch.text+'%'' or bz like ''%'+EdtSearch.text+'%'')';
[解决办法]
sqlstr:='select * from TempPljxKx where (Pzh not like ''%'+EdtSearch.text+'%'' or bz not like ''%'+EdtSearch.text+'%'')';


[解决办法]
sqlstr:='Delete from TempPljxKx where (Pzh not like ''%'+EdtSearch.text+'%'' or bz not like ''%'+EdtSearch.text+'%'')';

热点排行