0

I have a table, table1 that has 129 rows. I'd like to join another table table2 with 429 rows to it, and end up with only 129 rows.

So far, I've tried:

select *
from table1
left join table2 on table1.id = table2.id;

But I always end up with 429 rows.

I'm clearly missing something here. Do you know what it is?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Joshua M. Moore
  • 381
  • 6
  • 20

2 Answers2

1

Inner join is what you might need

select table1.*
from table1
inner join table2 on table1.id = table2.id;
tourist
  • 4,165
  • 6
  • 25
  • 47
1

This image always helps me when constructing SQL joins. It's usually the top result when googling "sql joins"

enter image description here

Jake
  • 1,016
  • 8
  • 9