Forum Discussion

smogger914's avatar
9 years ago

How to query messages with no views?

Hey,

 

I want to create a nightly process that will pick up all unviewed messages and perform some task in an external system. What would be the best way to query messages with 0 views? I was looking into the Message Resource from API V2 Message Resource .

 

I found the metrics.views on the message resource, but it seems that I can only use that field in order by:

 

SELECT * FROM messages ORDER BY metrics.views DESC

This doesn't seem to work:

SELECT * FROM messages where metrics.views = 0

What would be the best way to do this query?

  • Found it in the docs somewhere: 

     

    SELECT * FROM messages WHERE replies.count(*)=0 AND depth=0
  • Found it in the docs somewhere: 

     

    SELECT * FROM messages WHERE replies.count(*)=0 AND depth=0