Solved

find words LIKE "some letters" query MySql

Posted on 2013-02-07
2
376 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

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…
I use MySQL for many of my development projects in a Windows environment. To manage my databases (and perform queries) for years I used a tool called MySQL administrator.  This tool has since been replaced by MySQL Workbench. So I decided to m…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

730 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