Solved

find words LIKE "some letters" query MySql

Posted on 2013-02-07
2
375 Views
Last Modified: 2013-02-07
I have in MySql database for example this terms:
1. Techniker
2. Bautechniker
3. Weintechnologe

I need query that will display all results that contain letters that user types.
For example if someone types letter "t" it should give all results that have letter t anywhere in the word. That means all three results given above as example.

If someone types letters "te" or "tec" or "tech" or "techn" it should give all three results above given as example.

If someone types letters "techni" it should give results 1 and 2.

If someone types letters "techno" it should give result 3. etc.

Thank you for any help
0
Comment
Question by:mankis
2 Comments
 
LVL 6

Accepted Solution

by:
esolve earned 500 total points
ID: 38864312
SELECT * FROM Table WHERE Column LIKE '%SearchPhrase%'

or

DECLARE @Param VARCHAR(50)
SET @Param = '%te%'

SELECT * FROM Table WHERE Column LIKE @Param

or

SELECT t1.Notes,
       t2.Name
  FROM Table1 t1
  JOIN Table2 t2 ON t1.Notes LIKE CONCAT('%', t2.Name ,'%')

or

http://www.mysqltutorial.org/sql-like-mysql.aspx
0
 

Author Comment

by:mankis
ID: 38864371
I just realized I asked wrong question but your solution is correct for what I asked so I will close question and give you the points. Thank you.
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Fore-Foreword Today (2016) Maxmind has a new approach to the distribution of its data sets.  This article may be obsolete.  Instead of using the examples here, have a look at the MaxMind API (https://www.maxmind.com/en/geolite2-developer-package). …
Creating and Managing Databases with phpMyAdmin in cPanel.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question