title: Select users which have at least one successful and one failed payment per month in PostgresQl
body: <p><a href="https://i.stack.imgur.com/6720n.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6720n.png" alt="enter image description here" /></a></p>
  <p>How can I select users from this kind of table that have at least one successful and one failed payment per month?
  For example if the user has payments in March, April and May and in may there was only ten successful payments we don't want to show that user but if the user has had payments for as long as 10 months an in each month there are failed(false) and successful(true) payments, we want to show that user....</p>
  <p>In this case we would only show users with user id 1 and 3</p>
  <p>for now my query looks like this :</p>
  <pre><code>SELECT DISTINCT date_trunc('month', paydate)as uniquemonth
       , success
       ,user_id 
  FROM payments order by user_id,uniquemonth
  </code></pre>