我正在使用PDO连接到我的数据库。我想执行查询并仅从查询中排除特定的行。我不确定该怎么做。从我从另一个问题中得到的建议,我发布了这是我当前的解决方案,但是它不起作用$queryProfileCode = $dbh->prepare("SELECT profile_code FROM tableBusinessProfiles WHERE profile_code = ? AND NOT EXISTS(SELECT * FROM tableBusinessProfiles WHERE profile_code = $businessProfileIDUrl)");$queryProfileCode->bindValue(1,$profileCode);$queryProfileCode->execute();$resultTableProfileCode = $queryProfileCode->fetchAll();我找不到如何从查询中排除特定记录。 最佳答案 您的查询应该是SELECTprofile_codeFROM tableBusinessProfilesWHEREprofile_code != $businessProfileIDUrl要么SELECTprofile_codeFROM tableBusinessProfilesWHEREid NOT IN ($businessProfileIDUrl);MySQL的“不等于”运算符是!=和 **关于php - PHP PDO-从查询中排除特定行,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/25993331/
10-12 00:05
查看更多