SQLite Forum

Cannot select a value that matches another column name

Cannot select a value that matches another column name

(1) By anonymous on 2021-09-23 16:37:27 [source]

Is this a bug or is there a work around: https://stackoverflow.com/questions/69303775/sqlite3-how-to-select-the-value-of-a-column-that-matches-another-column-name

(2) By Larry Brasfield (larrybr) on 2021-09-23 16:48:52 in reply to 1 [link] [source]

I don't think it's a bug.

The remedy, which I refuse to call "a work around", is to use doublequote for identifiers and singlequote for SQL string literals.

I must confess that the stackoverflow original inquiry contains way too much noise for me to study it in detail,a but just sticking to SQL syntax seems to be enough here.

a. If somebody posing a question cannot bother to weed out superfluous aspects of their posed situation, why should anybody else bother to decide what is germane?

(3.1) By Simon Slavin (slavin) on 2021-09-24 11:27:28 edited from 3.0 in reply to 1 [link] [source]

The post that starts that thread shows a misunderstanding of SQL. Double quote characters indicate an entity name: a table name or a column name. To specify a string you use apostrophes (single quote characters). For instance, the line

SELECT * FROM Test WHERE Name = "Value";

should be

SELECT * FROM Test WHERE Name = 'Value';