drake900918 2013-07-15 09:53
浏览 370

根据多个值更新多个字段

I have a little issue that I can't figure out, basically a user fills in a form, this data saves into a table, but i have another table where based on some values will update a value in that table to yes.

So for example in my form i have value1, value2, value3, value4. all of which are drop down menus with values in that save into a field of the same name in table1.

Now in table2 i have a field called spaces, and spacetaken. Each has of these values in this table has corresponds its id to that of value1/2/3/4 fields in tabl1. I hope i explained that ok.

Now basically when i save a value i want it to update spacetaken to yes, so for example value1 could be 44, value2 could be 55 and both were selected in drop down and saved to table1, now i want to update table2 spacetaken to yes where spaces = value1 and value2

I have this so far

UPDATE table2 SET spacetaken='yes' WHERE spaces='value1' AND spaces='value2'

this doesnt work.

but

UPDATE table2 SET spacetaken='yes' WHERE spaces='value1'

will set the space with id same as value1 to taken - yes, basically i want a way to set spacestaken to yes based on multiple values.

Sorry if i didnt explain this very well.

Thanks in advance.

Ian

  • 写回答

3条回答 默认 最新

  • dougu1985 2013-07-15 09:55
    关注

    How can your value be'value1' AND 'value2' at the same time?

    Try using OR instead...

    评论

报告相同问题?

悬赏问题

  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?
  • ¥100 求三轴之间相互配合画圆以及直线的算法
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败