我有update
声明:
UPDATE quotedetailextensionbase qd
SET qd.new_capvehicleid = (SELECT cv.new_capvehicleid
FROM vwCapidLookup cv
WHERE cv.new_capid = qd.new_capid
AND cv.new_captype = qd.new_captype)
我收到了错误,但我不确定原因
' qd'
附近的语法不正确
答案 0 :(得分:2)
似乎使用update-join语句更容易实现此结果:
UPDATE qd
SET new_capvehicleid = cv.new_capvehicleid
FROM quotedetailextensionbase qd
JOIN (SELECT new_capvehicleid
FROM vwCapidLookup) cv ON cv.new_capid = qd.new_capid AND
cv.new_captype = qd.new_captype
答案 1 :(得分:1)
请尝试以下SQL:
UPDATE quotedetailextensionbase
SET new_capvehicleid =
(SELECT cv.new_capvehicleid
FROM vwCapidLookup cv
WHERE cv.new_capid = qd.new_capid AND
cv.new_captype = qd.new_captype)
答案 2 :(得分:1)
SQL Server允许您执行联接更新:
import UIKit
class CustomCell: UITableViewCell {
@IBOutlet var Button: UIButton!
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
override func awakeFromNib() {
super.awakeFromNib()
}
override func setSelected(selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
}
}
这有意义吗?
答案 3 :(得分:0)
使用MERGE:https://msdn.microsoft.com/en-us/library/bb510625.aspx。当您从另一个表更新时,这是正确的。