Forum Discussion

sejago's avatar
sejago
Guide
4 years ago

Messages and Categories

I found an old post that referenced the below query: select x, y from messages where category.id = 'z' I have been trying to use this but judging from the documentation category.id isn't a part of ...
  • Kevin's avatar
    4 years ago

    You can use category.id as part of the WHERE clause. For example, I was able to run this LiQL query in the API Browser (in Studio) and get the appropriate results:

    SELECT subject, view_href FROM messages WHERE category.id = 'leaf'

    You can also use an IN clause for more than one category

    SELECT subject, view_href FROM messages WHERE category.id IN ('leaf','preface') 

    and add a depth comparison if you only want replies

    SELECT subject, view_href FROM messages WHERE category.id = 'leaf' AND depth > 0

    or

    SELECT subject, view_href FROM messages WHERE category.id IN ('leaf','preface') AND depth > 0