0
我有以下的SQL腳本。從SQL翻譯到SQLAlchemy
SELECT *
FROM movies
LEFT JOIN possession
ON movies.id = possession.movie_id
AND possession.master_id = ?
WHERE possession.id is NULL
ORDER BY movies.id DESC
並需要幫助來說明sqlalchemy。 請有人可以幫我嗎?
下不起作用:
movies = movie.Movie.query.join(possession.Possession, movie.Movie.id == possession.Possession.movie_id)\
.filter(possession.Possession.master_id == session.get('userId'))\
.filter(not_(possession.Possession.id)).order_by(movie.Movie.id.desc()).all()
非常感謝您!
乾杯
您的SQL查詢'master_id',但'user_id':
產生。那是故意的嗎? – Blender 2013-04-21 06:47:53
這是一樣的...對不起! :-)但我在這裏改變了它。 – user1644033 2013-04-21 06:49:31