Return rows where both tables match.

Section: joins

Inner join two tables

sql
sql
SELECT o.id, u.email, o.status
FROM orders o
INNER JOIN users u ON u.id = o.user_id;
Explanation

`INNER JOIN` excludes rows without a matching parent or child.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing joins
Left join to keep unmatched parent rows
Return all rows from the left table and matching rows from the right table.
OpenIn sheetsqlsame section
Join and aggregate child rows
Count child rows per parent.
OpenIn sheetsqlsame section
Self join a table
Join a table to itself using aliases.
OpenIn sheetsqlsame section
Join to a derived table
Compute an aggregate once and join it back.
OpenIn sheetsql1 tag match
Filter with a subquery
Return users who have at least one paid order.
Use EXISTS for correlated filtering
Return users who have orders.