I have customer and group tables, in many to many relationship. For example I have gold group. This group consist of some customer instance. I need list of customer that NOT IN gold member. Simple solution I use this query
Select * from customer where id not in (select customer_id from customer_group where group_id = 1)
This solution to be worst, when my database grow up, thousands customer instance. I need suggestion of an effective approach for this condition.