title: MySQL - Get all rows from left table per group on right table
body: <p>I need to show all records from table A per user_id in table B, even if not matched. I have tried with LEFT JOIN and GROUP-ing but did not achieved my expected result. Also my skill on SQL is not good, so need help.</p>
  
  <p>Here is my table data:</p>
  
  <pre><code>Table A : gateways
  =========================
  | ID | Gateway          |
  =========================
  |  1 | Paypal           |
  |  2 | Webpay           |
  |  3 | Stripe           |
  =========================
  
  Table B : gateway_user
  ==================================
  |  GatewayID |  UserID  | Active |
  ==================================
  |     1      |     1    |   Y    |
  |     1      |     2    |   Y    |   
  |     1      |     3    |   N    |
  |     2      |     1    |   Y    |
  |     2      |     2    |   N    |
  |     3      |     1    |   Y    |
  ==================================
  </code></pre>
  
  <p>The result I expect is to see all results from left table per user_id on right, even if it doesn't exist in Right Table. </p>
  
  <pre><code>==================================
  |  GatewayID |  UserID  | Active |
  ==================================
  |     1      |     1    |   Y    |
  |     1      |     2    |   Y    |
  |     1      |     3    |   N    |
  |     2      |     1    |   Y    |
  |     2      |     2    |   N    |
  |     2      |     3    |  null  |
  |     3      |     1    |   Y    |
  |     3      |     2    |  null  |
  |     3      |     3    |  null  |
  ==================================
  </code></pre>
  
  <p>Thank you.</p>