Solved

find words LIKE "some letters" query MySql

Posted on 2013-02-07
2
370 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

Backup Your Microsoft Windows Server®

Backup 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

This guide whil teach how to setup live replication (database mirroring) on 2 servers for backup or other purposes. In our example situation we have this network schema (see atachment). We need to replicate EVERY executed SQL query on server 1 to…
Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikipedia.org/wiki/PHP  Very powerful.  But a…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

776 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