I am trying to do the following query:
cursor.execute("SELECT DISTINCT(provider) FROM raw_financials
WHERE vendor_id="%s" OR title='%'", (vendor_id, title))
My problem is that the title can be anything, for example it can be "Hello, Sir", 'Yes' he responded. So when I do the above, I could get a (bad) return value, such as An Elf\\'s Story (which raises a SQL error).
How would I correctly quote the SQL statement and the title here?
A\'B), some want doubled-quotes (A''B), etc...