like一般用于条件模糊Select * From table1 where field1 like '%' -- 选出所有记录 Select * From table1 where field1 like 'a%' -- 选出字段field1以a开头的记录 Select * From table1 where field1 like '%a%' -- 选出字段field1包含a的记录...... 具体自己再看看帮助文件吧
%代表所有的 另外还是?之类的,代表一个字符,就像DOS下的DIR命令中的?、*之类的用法一样
is 是完全匹配。 like是相似的意思吧。
like = 像 啊; 比如说一个字符串中有 'A',那么, if A Like '%'+ 这个字符串 + % ;这个条件就成立; delphi中; with Query do begin Close; SQL.Clear; SQL.Add('select * from FieldName Like : Value'); Params.Items[0].AsString := '%' + Edit1.Text + '%'; PrePare; Open; end; //只要那个字段里有Edit1.Text的数据的话,就成功了;
Select * From table1 where field1 like 'a%' -- 选出字段field1以a开头的记录
Select * From table1 where field1 like '%a%' -- 选出字段field1包含a的记录......
具体自己再看看帮助文件吧
另外还是?之类的,代表一个字符,就像DOS下的DIR命令中的?、*之类的用法一样
like是相似的意思吧。
比如说一个字符串中有 'A',那么, if A Like '%'+ 这个字符串 + % ;这个条件就成立;
delphi中;
with Query do
begin
Close;
SQL.Clear;
SQL.Add('select * from FieldName Like : Value');
Params.Items[0].AsString := '%' + Edit1.Text + '%';
PrePare;
Open;
end;
//只要那个字段里有Edit1.Text的数据的话,就成功了;