0

i have tables:

user_payments
ID | OK |
----------
 1 |  1 |
 2 |  0 |
 3 |  1 |
 4 |  1 |
 5 |  1 |
 6 |  0 |

user_groups
rID | ID | groups |
-------------
  1 |  4 | member |
  2 |  5 | member |

I need to insert ID which has OK=1 to user_groups as member, but only if isn't already there. Is there any way of 'not join', or am I going totaly wrong way?

Thank you for your help

Gomi
  • 632
  • 1
  • 7
  • 23

1 Answers1

0

You are looking for a left outer join with a condition is null on any column in the joined table.

Andreas Wederbrand
  • 38,065
  • 11
  • 68
  • 78