dimanche 24 juillet 2016

Django raw SQL with WHERE

What is wrong with this syntax,

postModel = list(PostModel.objects.raw(
'SELECT * 
WHERE author = "art", max(pub_date), count(topic_id) 
AS freq, count(DISTINCT author) 
AS contributors 
FROM crudapp_postmodel 
GROUP BY topic_id 
ORDER BY pub_date DESC'
))

All worked fine before I put in WHERE author = "art"

OperationalError: near ",": syntax error

Thanks

Aucun commentaire:

Enregistrer un commentaire