MySQL的:
我可以使用此查询将数据从另一个表插入到一个表中:
INSERT INTO design (id_event,id_theme,color_main,color_bg)
SELECT '123',
'5',
color_main,
color_bg
FROM theme
WHERE id_theme='5'
我也可以更新它,如下所示:
UPDATE design INNER JOIN theme ON design.id_theme=theme.id_theme
SET design.color_main=theme.color_main, design.color_bg=theme.color_bg
WHERE id_event='123'
是否可以将这两个查询合并为一个,如下所示:
INSERT INTO design (id_event,id_theme,color_main,color_bg)
SELECT '123','5',color_main,color_bg FROM theme WHERE id_theme='5'
ON DUPLICATE KEY UPDATE id_theme='5',color_main=???,color_bg=???
感谢。
答案 0 :(得分:0)
您可以使用:
function addDeleteBtn(x, y, w){
$(".deleteBtn").remove();
var btnLeft = x;
var btnTop = y - 30;
var widthadjust=w/2;
btnLeft=widthadjust+btnLeft-1
var deleteBtn = '<img src="https://www.funagain.com/images/old/common/delete-icon.png" class="deleteBtn" ' +
'style="position:absolute;top:'+btnTop+'px;right:'+btnLeft+'px;cursor:pointer;"/>';
$(".canvas-container").append(deleteBtn);
}
canvas.on('object:selected',function(e){
addDeleteBtn(e.target.oCoords.mt.x, e.target.oCoords.mt.y, e.target.width);
});
canvas.on('mouse:down',function(e){
if(!canvas.getActiveObject())
{
$(".deleteBtn").remove();
}
});
canvas.on('object:modified',function(e){
addDeleteBtn(e.target.oCoords.mt.x, e.target.oCoords.mt.y, e.target.width);
});
canvas.on('object:moving',function(e){
$(".deleteBtn").remove();
});
$(document).on('click',".deleteBtn",function(){
if(canvas.getActiveObject())
{
canvas.remove(canvas.getActiveObject());
$(".deleteBtn").remove();
}
});