Domanda

I have a MySQL table which contains comma-separated values like this:

first row=(A,AB)
second row=(AC, AE)

I want to select the rows which have A in their set not AC OR AE. I am using symfony2 in my code.

$query = $query->andWhere("FIND_IN_SET('".trim($tag)."',advNews.advNewsTags)");

Its Return Error: Expected known function, got 'FIND_IN_SET'

But if i use query in sqlyog like

select * from advice_news where  adv_news_type = 'news' AND FIND_IN_SET  ('sdf',adv_news_tags)

its work fine.

Tell me any solution i will use FIND_IN_SET in symfony2.

È stato utile?

Soluzione

You need to add FunctionNode to Doctrine and Symfony. I had the same problem with SOUNDS LIKE. You can find my solution at http://piotrpasich.com/full-text-searching/ in SOUNDEX chapter.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top