我有一条 SQL 语句:
$sql = "SELECT * FROM user_events WHERE userID =" . $uid . " OR groupID = (IN ($gId) WHERE userID IS NULL) ORDER BY timestamp DESC";
打印时看起来像这样:
SELECT * FROM user_events WHERE userID = 34 OR groupID =(IN (44,45) WHERE uID IS NULL) ORDER BY timestamp DESC
我要做的是从数据库中选择userId
匹配特定变量或groupID
匹配 CSV 变量的任何userID
行NULL
。
谁能解释我在这里做错了什么?我被卡住了!