我正在尝试从我的pymysql查询中排除特定项目:
results = """SELECT t.id, s.name
FROM database.table as t
LEFT JOIN (database.secondtable as s)
ON (t.id = s.person_id)
WHERE s.name != 'John';"""
db_conn pymysql.connect(host='xx', user='xx')
df = pd.read_sql(data, con=db_conn)
sql代码在我的mysql服务器中工作,以排除任何名为John的人,但是当我在Python中运行它时,那些名为John的人不会被排除在外。我如何在Python中纠正这个问题?