我得到0 rows affected
的输出有人可以告诉我为什么这个更新声明不起作用?
UPDATE
LEAGUE
SET
[ALL_STAR] = '1'
, [PLAYER] = 'ACTIVE'
, [DATE] = GETDATE()
FROM
ASSOCIATION an
LEFT JOIN LEAGUE lg ON lg.[PLAYER_ID] = an.[PLAYER_ID]
WHERE
lg.[ALL_STAR] IS NULL
AND lg.[PLAYER] IS NULL
AND lg.[DATE] IS NULL
答案 0 :(得分:0)
尝试执行select语句以查看将受影响的记录。
我认为你所追求的是“NOT IN”声明。在测试时,您应该使用事务,这样您就可以在不更改任何记录的情况下进行回滚。
class ProductModel(QAbstractListModel):
ManufacturerRole, ModelNumberRole, DescriptionRole = range(Qt.UserRole, Qt.UserRole + 3)
def __init__(self, parent=None):
QAbstractListModel.__init__(self, parent)
self._products = []
def addProduct(self, product):
self.beginInsertRows(QModelIndex(), self.rowCount(), self.rowCount())
self._products.append(product)
self.endInsertRows()
def removeProduct(self, model_number, manufacturer):
selecteds = filter(lambda product: product['manufacturer'] == manufacturer and product["modelNumber"] == model_number,
self._products)
for selected in selecteds:
row = self._products.index(selected)
self.beginRemoveRows(QModelIndex(), row, row)
self._products.pop(row)
self.endRemoveRows()
def rowCount(self, parent=QModelIndex()):
return len(self._products)
def data(self, index, role=Qt.DisplayRole):
if 0 <= index.row() < self.rowCount():
product = self._products[index.row()]
if role == ProductModel.ManufacturerRole:
return product["manufacturer"]
elif role == ProductModel.ModelNumberRole:
return product["modelNumber"]
elif role == ProductModel.DescriptionRole:
return product["description"]
elif role == Qt.DisplayRole:
return "{} {} {}".format(*product.values())
class ProductCompler(QCompleter):
def pathFromIndex(self, index):
return index.data()
if __name__ == '__main__':
app = QApplication(sys.argv)
le = QLineEdit()
completer = ProductCompler(le)
le.setCompleter(completer)
model = ProductModel()
completer.setModel(model)
completer.setCompletionRole(ProductModel.ModelNumberRole)
model.addProduct({"manufacturer": "StarTech", "modelNumber": "STANDOFF122", "description": "description"})
model.addProduct({"manufacturer": "StarTrek", "modelNumber": "STANDOFF111", "description": "description"})
model.addProduct({"manufacturer": "StackOverFlow", "modelNumber": "STANDOFF100", "description": "description"})
model.addProduct({"manufacturer": "StarTech", "modelNumber": "ABCSTANDOFF122", "description": "description"})
model.addProduct({"manufacturer": "StarTrek", "modelNumber": "ABCSTANDOFF111", "description": "description"})
model.addProduct({"manufacturer": "StackOverFlow", "modelNumber": "DFSTANDOFF100", "description": "description"})
model.removeProduct("STANDOFF111", "StarTrek")
le.show()
sys.exit(app.exec_())