So, I have this query:
SELECT count(*) AS count FROM table1 INNER JOIN "some query"
WHERE "some more query"
OR (table.smowid NOT LIKE (58)) OR "rest of query"
Sorry for the unclear code, the full query is quite big, but the problem is in the table.smowid NOT LIKE (58) part.
This is the error I get:
ERROR: operator does not exist: integer !~~ integer
LINE 11: or ( (table.smowid) NOT LIKE (58))
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
I unfortunately, don’t know much about casts and types, but why is the DB complaining when it’s going from integer to integer?
I tried CASTING by saying (CAST (table.smowid) AS INTEGER) NOT LIKE (58) but that didn’t work, I also tried (table.smowid :: integer) NOT LIKE (58) but that also didn’t work for some reason.
So, what should I do? Thanks for all the help.
you should cast them both to text or, better yet, have a
smowiscolumn with all thesmowivalues as text to save the overhead of casting each time.