question

DoeL avatar image
DoeL asked

the statemen is not as field on database

Hi . . . i try to create an sql for "search engine" where it can read the TxtFind which it is not same with the values on database field. example : i try to search "Yogyakarta" but i just write it with "Jogja" and it must be found, can i? and more example, i try to search "United Kingdom" and i just write on search box with "UK" some body can help me how to write query in WHERE . . . for my script : select B.JdlBuku as [Judul Buku], PR.NamaPengarang as [Pengarang], K.Kategori, Jumlah as [Tersedia], R.Blok as [Blok Rak], R.NoRak as [No. Rak] from buku B inner join kategori K on B.IdKategori = K.IdKategori inner join Rak R on B.IdRak = R.IdRak inner join pengarang PR on B.IdPengarang = PR.IdPengarang inner join penerbit PN on B.IdPenerbit = PN.IdPenerbit where B.JdlBuku like '% + txtSearch + %' OR K.Kategori like '% + txtSearch + %' OR PR.NamaPengarang like '% + txtSearch + %' or PN.Nama like '% + txtSearch + %' **WHERE** *your answer . . .*
selectwhere
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Grant Fritchey avatar image
Grant Fritchey answered
What you're looking for is known as fuzzy searches. They're actually extremely difficult to get right. One thing that could help with that type of search [is SOUNDEX][1]. Here's [more information][2] on it. Here's an article [on other choices][3] for fuzzy searches. [1]: http://support.microsoft.com/kb/100365 [2]: http://technet.microsoft.com/en-us/library/ms187384.aspx [3]: http://anastasiosyal.com/POST/2009/01/11/18.ASPX
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.