本文介绍了如何编写查询以按城市,州,县之类的位置进行搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个像搜索框一样的文本框.
如何编写对城市,州等搜索数据的查询

hi all,

i have one textbox like search box..
how to write a query for search data like city,state

TableA
------
Address1
Address2
City
State
Zip


表格中以上所有列均为全文索引.假设用户输入的是"123 Apple street FL 33647",而我在表中的记录为


All the above columns in the table are full text indexed. Let''s say if the user enters "123 Apple street FL 33647" and I have a record in the table as

 City = "Tampa", State = "FL". I would like the query to return this.am enter into the text in search box like Tampa,FL. but i did not get any records. my query like this
CITY LIKE '%'+@SERCHTEXT OR CITY LIKE '%'+@SERCHTEXT+'%' OR CITY LIKE @SERCHTEXT+'%'
OR
[STATE] LIKE '%'+@SERCHTEXT OR [STATE] LIKE '%'+@SERCHTEXT+'%' OR [STATE] LIKE @SERCHTEXT+'%'


当进入城市或州时,我只有正确的输出

你能让我知道我将如何做吗?

谢谢您.


when enter the city or state only i got the correct output

can you please let me know how I would do this.

thanking you

推荐答案


Select * from TableA where city like @Str1 or state like @Str1 or country like @str3



这篇关于如何编写查询以按城市,州,县之类的位置进行搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-26 06:05
查看更多