2

With PostgreSQL and MySQL it is all right to do something like

SELECT * FROM mytable WHERE (column1, column2) = ('value1', 'value2');

When I tried the same thing on SQLite3, it gave me an exhausting error message:

Error: near ",": syntax error

From the SQLite documentation I can't figure out whether it supports tuples or not. Can anyone shed some light on this?

Lukas Eder
  • 211,314
  • 129
  • 689
  • 1,509
koniiiik
  • 4,240
  • 1
  • 23
  • 28

2 Answers2

2

Do like this:

SELECT * FROM mytable WHERE column1 = 'value1' AND column2 = 'value2'

Adi
  • 5,113
  • 6
  • 46
  • 59
  • This works for the case given but not where you want to fetch multiple rows like this using IN. To cover that you'd be stuck doing a monster `(x = ? AND y = ?) OR (x = ? AND y = ?) OR ....` – mikepurvis Sep 06 '20 at 16:56
2

The syntax is WHERE expr and as we can see in the syntax diagram for expr,
a column (expr) followed by a comma isn't supported.

expr: enter image description here

Nick Dandoulakis
  • 42,588
  • 16
  • 104
  • 136