JAEN

SQL

SELECT ... JOIN

SafeJoin tables

SELECT ... FROM a JOIN b ON a.id = b.a_id;

Combines tables: INNER keeps matches only, LEFT keeps all left rows. Index your join keys.

Examples

  • SELECT u.name, o.total FROM users u LEFT JOIN orders o ON o.user_id = u.id;Users with or without orders

Syntax

SELECT cols FROM a [INNER|LEFT] JOIN b ON cond;

Before you run it

Read only.

Related commands

The same reference, with no signal at all

Every command on this site, held on your device. The app adds 632 more: 1,510 commands and 120 fix flows, searchable with no connection. Free to install, no ads (some content is a one-time purchase).

Get it free on the App Store