我正在使用python3.6和py-postgresql==1.2.1。我有以下声明:
db.prepapre("SELECT * FROM seasons WHERE user_id=$1 AND season_id=$2 LIMIT 1),其中 season_id 可以为 NULL。
我希望能够season_id通过None作为NULL 获得最新的记录$2 param,但它不起作用。相反,我需要创建第二条语句:
db.prepapre("SELECT * FROM seasons WHERE user_id=$1 AND season_id IS NULL LIMIT 1)
它必须与season_id = NULL不工作有关season_id IS NULL,但有没有办法使这项工作?