Pergunta

I want to get the part of words from whole word.

If I search the word apples

I need result of App,Apple,Apples

Some time if we enter the word 'apple'

it will give the result of (App,Apple,Apples)

SELECT * FROM pwyju_pin_tag WHERE pin_tag_words LIKE "%Apples"
Foi útil?

Solução 2

If you need to search for all words begin with App

just use % after App in your query

SELECT * FROM pwyju_pin_tag WHERE pin_tag_words LIKE "App%"

If you need to search for all words contain App

then use % before App and after it in your query

SELECT * FROM pwyju_pin_tag WHERE pin_tag_words LIKE "%App%"

Outras dicas

Just switch the operands around:

SELECT * FROM pwyju_pin_tag WHERE 'apples' LIKE CONCAT(LOWER(pin_tag_words), '%')
declare  @search nvarchar(24) ;   
set @search='apples';

 SELECT * FROM pwyju_pin_tag WHERE pin_tag_words 
  LIKE CONCAT(SUBSTRING ( @search ,0, x ),'%')

x is parameter where you can set it in every value you want (considering it is <@search.length)

In this case (where you want 'app') you must set x=3

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top