I have these tables:
users:
|user_id|user_name|
|-------|---------|
| 1 | John |
|-------|---------|
| 2 | Mark |
|-------|---------|
| 3 | Paul |
|-------|---------|
records:
| record_id | user_id | records |
|-----------|---------|--------------|
| 1 | 3 | lorem ipsum |
|-----------|---------|--------------|
| 2 | 3 | dolor sit |
|-----------|---------|--------------|
| 3 | 3 | consectetur |
|-----------|---------|--------------|
| 4 | 1 | adipisicing |
|-----------|---------|--------------|
| 5 | 3 | eiusmod |
|-----------|---------|--------------|
| 6 | 1 | consectetur |
|-----------|---------|--------------|
What I want is to select users who have records. In this case, only John and Paul should return.
Using a subquery:
Or using an INNER JOIN: