Re: Making query with LIKE where __contains is not enough.

2010-06-07 Thread Gyanit Singh
2 %% works perfectly. For future stumblers of this post. CLASSNAME.objects.raw("select * from table where full_name like'%%ipod% %nano%%' ") works!! Thanks mrfunyon. ps: This should be added to the doc. On Jun 6, 9:03 pm, mrfunyon wrote: > Try using 2 %'s  in your query > like this: > CLASSNAME.

Re: Making query with LIKE where __contains is not enough.

2010-06-06 Thread mrfunyon
Try using 2 %'s in your query like this: CLASSNAME.objects.raw("select * from table where full_name like '%%ipod%%nano%%' ") On Jun 6, 6:17 pm, Gyanit Singh wrote: > Hi All, > > As start I know there is __contains [http://docs.djangoproject.com/en/ > dev/ref/models/querysets/#contains]. But it o

Making query with LIKE where __contains is not enough.

2010-06-06 Thread Gyanit Singh
Hi All, As start I know there is __contains [http://docs.djangoproject.com/en/ dev/ref/models/querysets/#contains]. But it only does LIKE '%word%' query. I want to do LIKE '%word1%word2%' query. for e.g. select * from table where column LIKE '%ipod%nano%'. The raw sql query is trying to replace