I’m creating a SQL query string in android code which goes as follow:
SELECT strftime('%m', DATE) "MONTH", strftime('%Y', DATE) "YEAR" FROM EXPENSES group by month, year ORDER BY MONTH DESC, YEAR DESC
I know that if I want to get " I write just ' inside a string,
but what if I want to get that single char '?
Could anybody properly enclose this query in quotes, so it works fine?
Your question seems a bit confused as to what you need to escape and when. This should cover it:
To escape a single quote in SQL, you just double it up.
In Java, you just use double quotes around the outside.
To escape the double quotes in Java, use a leading slash
\as so: