gpt4 book ai didi

php - 排除 "IN"子句中的值

转载 作者:行者123 更新时间:2023-11-29 06:12:28 28 4
gpt4 key购买 nike

我应该如何排除“IN”子句中的值?

    $Graduates = "45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,73,74,75,76,84,85,86,87,88,89,91,
92,93,94,95,96,98,99,100,101,103,104,105,106,107,108,109,110,111,112,113,114,117,122,123,126,127,131,135,136,137,
138,139,140,142,143,146,156"; //MajorID

$QryFirstNursing = "SELECT *
FROM ".$SemYearSettings->getYearSem($Enroll)."
WHERE ".$SemYearSettings->getYearSem($Enroll).".MajorID IN (".$Graduates.")
AND ".$SemYearSettings->getYearSem($Enroll).".Category = ".$CategoryIDN;
$resultFirstNursing = openQry($QryFirstNursing);

请大家帮忙。谢谢

最佳答案

@Ardit Meti 权利。它看起来像这样:

    $Graduates = "45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,73,74,75,76,84,85,86,87,88,89,91,92,93,94,95,96,98,99,100,101,103,104,105,106,107,108,109,110,111,112,113,114,117,122,123,126,127,131,135,136,137,138,139,140,142,143,146,156"; //MajorID

$tableName = $SemYearSettings->getYearSem($Enroll);

$QryFirstNursing = "SELECT *
FROM {$tableName}
WHERE {$tableName}.MajorID NOT IN ('{$Graduates}')
AND {$tableName}.Category = {$CategoryIDN}";

$resultFirstNursing = openQry($QryFirstNursing);

关于php - 排除 "IN"子句中的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37586651/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com