You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The reason that the query returns 0 as the result is due to the fact that the string literal C1 is double-quoted and not single-quoted. In sqlite (the underlying engine/syntax of q), double-quoted strings are treated as identifiers (e.g. column names in this case), and not as string literals, which means that the original example query essentially compared between the value of column c2 to the value of column c1, returning an empty set.
Running the same query with single-quotes returns the correct results.
$ q -t "select count(distinct(c1)) from CEFR.txt where c2 = 'C1'"
2
I've changed the wrapping of the entire query to double-quotes as well in this query, to prevent the need escape the single-quotes.
CONTENT:
q -t 'select count(distinct(c1)) from CEFR.txt where c2 = "C1"'
result:
0
The text was updated successfully, but these errors were encountered: