select * from table where a=:a and b=:b and c=:c 这样一个查询语句
如果三个参数中的:c在没有值的情况下想要实现 select* from table where a=1 and b=2的效果,这个查询语句应该怎么写?
select * from table where a=:a and b=:b and c=:c 这样一个查询语句
如果三个参数中的:c在没有值的情况下想要实现 select* from table where a=1 and b=2的效果,这个查询语句应该怎么写?
if c is None:
sql = select * from table where a=1 and b=2
else:
sql = select * from table where a=:a and b=:b and c=:c