I have a lengthy SQL query that needs to be converted into a JavaScript variable.
The contact information is spread across separate rows using the + character.
However, the SQLite plugin is displaying a parsing error:
What is the correct way to format this query as a JS variable?
Any tips or advice would be greatly appreciated.
Here is how the query looks currently:
var sqlQuery =
"SELECT d.date AS DATE,"+
"IFNULL(NUMBER_OF_ALL_CALLS, 0) AS NUMBER_OF_ALL_CALLS,"+
"IFNULL(RESULT_DONE, 0) AS RESULT_DONE,"+
"IFNULL(RESULT_NOT_INTERESTED, 0) AS RESULT_NOT_INTERESTED,"+
"IFNULL(RESULT_NO_APP, 0) AS RESULT_NO_APP"+
"FROM"+
"(SELECT DATE('1970-01-01', '+' || (t4.i*10000 + t3.i*1000 + t2.i*100 + t1.i*10 + t0.i) || ' days') date FROM"+
"(SELECT 0 i UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) t0,"+
"(SELECT 0 i UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) t1,"+
"(SELECT 0 i UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) t2,"+
"(SELECT 0 i UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) t3,"+
"(SELECT 0 i UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) t4) d"+
"LEFT JOIN"+
"("+
" SELECT substr(m.date, 1, 10) as my_date, COUNT(m.ID) AS 'NUMBER_OF_ALL_CALLS',"+
" (SELECT COUNT(*) FROM dialed_calls subq WHERE subq.call_result = 'DONE'"+
"AND substr(m.date, 1, 10) = substr(subq.DATE, 1, 10)) as 'RESULT_DONE',"+
" (SELECT COUNT(*) FROM dialed_calls subq WHERE subq.call_result = 'NOT_INTERESTED'"+
"AND substr(m.date, 1, 10) = substr(subq.DATE, 1, 10)) as 'RESULT_NOT_INTERESTED',"+
" (SELECT COUNT(*) FROM dialed_calls subq WHERE subq.call_result = 'NO_APPOINTMENT'"+
"AND substr(m.date, 1, 10) = substr(subq.DATE, 1, 10)) as 'RESULT_NO_APP'"+
"FROM dialed_calls m"+
"GROUP BY my_date"+
") t"+
"ON d.date = t.my_date"+
"WHERE d.date BETWEEN '2014-09-02' AND '2014-09-10'"+
"ORDER BY d.date;";