我想執行我的功能,下面,但我得到一個錯誤 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/ (SELECT COUNT(1) FROM users WHERE registered_at BETWEEN '1293861600' AND '1303' at line 1")
這個查詢有什麼問題?
基本上我試圖用第二個SELECT語句來劃分第一個SELECT語句。
cursor.execute("(SELECT COUNT(1) FROM users WHERE "
" (registered_at BETWEEN '1293861600' AND '1303729537') "
" AND user_id IN ( SELECT parent_id FROM files "
" WHERE created_at > '1293861600'))/"
"(SELECT COUNT(1) FROM users "
"WHERE registered_at BETWEEN '1293861600' AND '1303729537') ")
此外,有沒有更好的方式來重新編寫此查詢?