I'm trying to create a categorical column, with 3 states:
subA, subB or Neither.
I'm working with SqliteStudio 3.1.0, RHEL7.0.
I loaded the my csv into SQLITE via Python/Pandas. Everything works as expected.
I added constraints in the GUI:
"fullpath" TEXT Unique NOT NULL.
I added the Sub
columns in SqiteStudio and double checked in Data table.
alter table data add column Sub text(100)
That works, no errors given. Then I try:
insert into data(Sub)
select fullpath, case
when fullpath like "%subA%" then "subA"
when fullpath like "%subB%" then "subB"
else "Neither" end
from data
I get this error which I don't understand.
[18:35:45] Error while executing SQL query on database 'test': 2 values for 1 columns
Best Answer
You are doing an
insert into
but you only specify one field (sub), then you select 2 fields, just as the error message says.You would either need to add a fullpath field to the data table and do:
Or you need to select one column