我有两张桌子:
列week
,week
和Team_Number
的{{1}}表
列Points
和Teams
的{{1}}表
我希望Team_Number
表Session1Points
列中sum
列的所有Points
{1}},然后将其添加到week
week
列中的表格。
我试过了:
Teams
没有用。我更新Session1Points
表后,我希望触发它。我需要先UPDATE Teams P
SET Session1Points =
(SELECT SUM(Points) from week
where week.Team_Number= P.Team_Number)
where P.Team_Number = New.Team_Number
吗?
答案 0 :(得分:1)
你可以这样使用JOIN
function readHtml(callback) { // pass in a callback to call once all rows are read and all html is accumulated
var html = '';
db.serialize(function() {
// read all the rows and accumulate html as before
db.each("SELECT rowid AS id, info FROM logger", function(err, row) {
html = html + '<tr><td>' + row.info + '<td><tr>';
}, function() {
callback(html); // use the second callback to signal you are done and pass the html back
});
});
}