Forum Discussion

Shivshankar's avatar
8 years ago

Like query in LiQL

Hi !

 

I am trying to fetch subject of all messages in particular board with certain keyword , formed this LiQL query

 

SELECT id,subject FROM messages WHERE board.id = '4' and subject MATCHES 'Batch'

The problem is , this "MATCHES" gives result of only those subject which have exact "Batch" as a word in them and won't give subject containing "BatchUpdate" as result . I want something which works similar to LIKE function in MYSQL for other database query languages.

Can someone provide with some kind of input to achieve this.

 

  • VikasB's avatar
    VikasB
    8 years ago

    Hi srujanayeruvaka  
    Did you notice it would not work if you are not using the braces surrounding to the text which RobertT missed in their post?  But it works fine with braces.

    SELECT * FROM messages WHERE board.id = 'XYZ' and subject MATCHES ('batch*')

    Shivshankar  have a look, it really works.

15 Replies

  • VikasB i have tested the query and found that ,yes this works fine for us. Thanks for all info and support.

  • srujanayeruvaka  i saw this discussion and i know it is a very old topic but i am facing a similar issue and has been trying for a long time to get it to work.I have below query and i have tried all the suggestions provided with combination and do not get any result.I do have the data though.Could you please help thanks in advance.

    SELECT id,body FROM messages WHERE body matches ('6246723261001')

    SELECT id,body FROM messages WHERE body matches ('6246723261001*')

    SELECT id,body FROM messages WHERE body matches ('*6246723261001*')

    data:

    SELECT id,body FROM messages WHERE id='483'

     

  • Hi sh030348 - Matches keyword sometimes doesn't work as expected. I would suggest you to file a support case with Khoros and report your use case.