这应该是非常基本但我无法弄清楚.有表’价值’
entity|attribute|value
frank - shirt - red
frank - hat - green
sam - shirt - blue
sam - hat - orange
我怎么设置所有的帽子颜色与衬衫颜色相同,同一个人给坦率的红帽子和山姆蓝帽子.
最佳答案
我正在寻找解决方案,我想出了这篇文章.
但是运行sql导致语法错误.
参考mysql文档
http://dev.mysql.com/doc/refman/5.0/en/update.html
我注意到 – 至少在版本5中 – mysql有不同的语法.
一般声明是:
update table t1,table t2
set t1.field1 = t2.field2,...,t1.fieldN = t2.fieldN
where t1.someid = t2.someid and t1.fieldX = '...' and t2.fieldY = '...'