Forum Discussion

PerBonomi's avatar
10 years ago

API 2 to find messages that are NOT in board X

I've been having some basic success using the new API, but one thing still has me stumped.

 

I want to find a user's messages , except the ones in one specific board.

 

Things I've tried:

SELECT * FROM messages WHERE author.login = 'username' AND board.id != 'ideas_submissions' limit 10

SELECT * FROM messages WHERE author.login = 'username' AND board.id !( 'ideas_submissions') limit 10

SELECT * FROM messages WHERE author.login = 'username' AND board.id <> 'ideas_submissions' limit 10

SELECT * FROM messages WHERE author.login = 'username' AND board.id !(IN 'ideas_submissions') limit 10

 

And many other options. No luck. Has anyone been able to do this?

  • How about looping through all the boards and excluding the one you don't want? I couldn't find any operator for !=
    • OlivierS's avatar
      OlivierS
      Lithium Alumni (Retired)

      PerBonomi per documentation, there isn't a 'NOT' operator:

       

      board.id
      • Comparison operators: =, IN()
      Note: Use board.id to filter message by a board.

       

      You can apply GrazittiI 's method or you can list all the boards you want in the IN clause (comma delimited).