Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

E0007 join-type-mismatch

JOIN condition compares incompatible types.

CodeNameCategoryDefault
E0007join-type-mismatchcorrectnesserror

What it reports

A JOIN ... ON condition compares columns whose types can't be compared. This usually means the wrong column was joined.

Example

SELECT u.id FROM users u JOIN orders o ON o.user_id = u.email;
error[E0007]: JOIN condition type mismatch: integer vs text
  --> q.sql:1:43
    |
  1 | SELECT u.id FROM users u JOIN orders o ON o.user_id = u.email;
    |                                           ^^^^^^^^^
    = help: JOIN condition should compare compatible types. Consider using explicit CAST.

Fixed:

SELECT u.id FROM users u JOIN orders o ON o.user_id = u.id;

Notes

The same mismatch outside a JOIN condition is reported as E0003.

Configuring

# sqlsift.toml
[rules]
join-type-mismatch = "warn"   # or "off"

Or for a single line: -- sqlsift:disable E0007. The examples use the schema on the Rules page.