gpt4 book ai didi

mysql - 我怎样才能使我的 where 语句在这里工作?

转载 作者:太空宇宙 更新时间:2023-11-03 10:53:26 26 4
gpt4 key购买 nike

我有这个更新查询,当我的 where 有 2 个条件时它可以工作,但是当我再添加 3 个时它不起作用。任何人都可以看看它并告诉我出了什么问题。谢谢。

这是我的查询:

$sSQLupdate = "UPDATE settings, holidaytype SET 
settings.companyName = '$companyname',
settings.companyAddress = '$companyaddress',
settings.companyContact = '$companycontact',
settings.excessot1 = '$excessot1',
settings.multiplierOT1 = '$multiplier1',
settings.excessot2 = '$excessot2',
settings.multiplierOT2 = '$multiplier2',
settings.ndRangeFrom = '$ND_in',
settings.ndRangeTo = '$ND_out',
settings.multiplierNd = '$NDmul',
holidaytype.multiplier = '$regularmul', *(mustbe in holidaytype.id = '1')
holidaytype.multiplier = '$specialmul', *(mustbe in holidaytype.id = '2')
holidaytype.multiplier = '$doubleregmulmul', *(mustbe in holidaytype.id = '3')
holidaytype.multiplier = '$doublespecmul' *(mustbe in holidaytype.id = '4')

WHERE settings.id = 1 AND holidaytype.id = '1' AND holidaytype.id = '2' AND holidaytype.id = '3' AND holidaytype.id = '4'";

最佳答案

试试这个:

WHERE settings.id = 1 AND holidaytype.id IN ('1','2','3','4')

要根据 holidaytype.id 条件更新 holidaytype.multiplier 我建议使用 CASE 语句或单独查询。

关于mysql - 我怎样才能使我的 where 语句在这里工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22682062/

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