SQL根据另一个不直接相关的表更新列

时间:2019-01-14 10:43:09

标签: mysql

我正在为穆德工作,由于年底将一次性登记整个年份的寄存器,因此未在正确的日期发布徽章。

课程日期是mdl_facetoface_sesion_dates.timestart 徽章日期为mdl_badgeissued.dateissued

我尝试了各种版本,以下似乎是我所拥有的最接近的版本。

我目前正在使用phpmyadmin。

UPDATE
    mdl_badge_issued
SET
     mdl_badgeissued.dateissued = mdl_facetoface_sesion_dates.timestart
FROM mdl_badge_issued
INNER JOIN mdl_badge_issued.userid ON mdl_badge_issued.userid = mdl_user.id 
INNER JOIN mdl_badge ON mdl_badge_issued.badgeid = mdl_badge.id 
INNER JOIN mdl_course ON cmdl_course.id = mdl_badge.courseid 
INNER JOIN mdl_facetoface ON mdl_facetoface.course = mdl_course.id 
INNER JOIN mdl_facetoface_sessions ON mdl_facetoface_sessions.facetoface = mdl_facetoface.id 
INNER JOIN mdl_facetoface_sessions_dates ON mdl_facetoface_sessions_dates.sessionid = mdl_facetoface_sessions.id

WHERE mdl_badgeissued.badgeid='62'

我想复制mdl_badgeissued.dateissued = mdl_facetoface_sesion_dates.timestart

1 个答案:

答案 0 :(得分:0)

以这种方式尝试:(您的语法错误)

import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Pane;
import javafx.stage.Popup;
import javafx.stage.Stage;

public class Example extends Application{

    public static void main(String... arguments){

        launch(arguments);
    }

    public void applyTo(Pane node, Popup parent){

        final double[] dragDelta = new double[2];

        node.setOnMousePressed(e -> {
            dragDelta[0] = parent.getX() - e.getScreenX();
            dragDelta[1] = parent.getY() - e.getScreenY();
            //code to bring parent Popup to front
        });

        node.setOnMouseDragged(e -> {
            parent.setX(e.getScreenX() + dragDelta[0]);
            parent.setY(e.getScreenY() + dragDelta[1]);
        });
    }

    @Override
    public void start(Stage primaryStage) throws Exception{

        Button b1 = new Button("Open p1");
        Button b2 = new Button("Open p2");

        HBox n1 = new HBox(new Label("This is p1"));
        HBox n2 = new HBox(new Label("This is p2"));
        n1.setMinSize(200, 120);
        n2.setMinSize(200, 120);
        n1.setStyle("-fx-background-color: blue; -fx-background-radius: 4px;");
        n2.setStyle("-fx-background-color: red; -fx-background-radius: 4px;");
        n1.setAlignment(Pos.CENTER);
        n2.setAlignment(Pos.CENTER);

        Popup p1 = new Popup();
        Popup p2 = new Popup();
        p1.getContent().add(n1);
        p2.getContent().add(n2);

        applyTo(n1, p1);
        applyTo(n2, p2);

        b1.setOnAction(event -> {
            if(!p1.isShowing()) p1.show(primaryStage);
            else p1.hide();
        });
        b2.setOnAction(event -> {
            if(!p2.isShowing()) p2.show(primaryStage);
            else p2.hide();
        });

        HBox root = new HBox(10, b1, b2);
        root.setAlignment(Pos.CENTER);

        primaryStage.setScene(new Scene(root, 500, 200));
        primaryStage.show();
    }

}