users with more than one of a gateway

/ Published in: SQL
Save to your folder(s)

Copy this code and paste it in your HTML
  2., users.sage_username,,
  4. user_gateways.gateway_name, user_gateways.merchant_id, user_gateways.merchant_key, user_gateways.login,,, user_gateways.type
  5. FROM organizations
  6. JOIN users ON organizations.created_by_id =
  7. JOIN user_gateways ON
  8. JOIN
  9. (SELECT organization_id, gateway_name, COUNT(gateway_name)
  10. FROM user_gateways
  11. GROUP BY organization_id, gateway_name
  12. HAVING COUNT(gateway_name) > 1) AS them
  13. ON them.organization_id =;

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.