"SELECT * FROM locations JOIN section_has_location ON locations.location_id = section_has_location.location_id WHERE section_has_location.chapter_id =2 AND section_has_location.section_id=2"
I get the error:
SQLError: ‘Error #3132: Data type mismatch.’, details:’could not convert text value to numeric value.’, operation:’execute’, detailID:’2300′
These are the tables:
CREATE TABLE locations ( location_id INTEGER, name TEXT, mask_id TEXT, x REAL, y REAL, content TEXT, image_url TEXT, type TEXT ); CREATE TABLE section_has_location ( chapter_id INTEGER, section_id INTEGER, location_id INTEGER );
How do I fix the query as to not cause the error?
update: I exported all the data, and imported into a new clean database. This seems to have solved that error.
Advertisement
Answer
I just took your code, created the tables and ran the query and it works fine.
Im guessing what you have done is maybe edited the type of one of the columns but the table hasn’t been updated, try sp_help tablenamehere or look in object explorer if you are using management studio and check what the datatype is of your columns, or if you can it may be easier to just drop both tables and recreate them