create table label_table(
label_id number not null,
label_name varchar2(50),
no_months number not null,
no_of_mobile_sims number not null,
no_of_services number not null,
delayed number not null,
value_of_client number(6,2),
constraint pk PRIMARY KEY(label_id)
);
create table client(
customer_id number not null,
customer_name varchar2(50) not null,
no_months number not null,
no_of_mobile_sims number not null,
no_of_services number not null,
delayed number not null,
value_of_client number(6,2),
constraint pk_key PRIMARY KEY(customer_id)
) ;
SELECT
l.label_id,
l.label_name,
k.customer_id,
k.customer_name
FROM
label_table l
inner JOIN client k ON k.value_of_client>l.value_of_client
ORDER BY 1;
如果我们从客户端进行选择*,我们将得到以下输出:
13 x_name 3 4 2 0 74.38
如果我们从label_table中进行选择*,我们将得到以下输出:
1 Diamond 2 2 2 0 70
2 Gold 2 1 2 2 50
我们有我们的客户x_name,他们加入了我们的电话公司,我想在哪里提供报告 它会说x_name是基于这2个表的公共列之间的比较的菱形客户端,我想要这样的输出:
13 x_name钻石
我想通过联接实现此目的,但问题是每次我尝试使用两个标签都可以标识我的客户时,因为他尊重两个标签的条件(>,<,!=,=)。 我的想法是,我有16个具有不同值的客户端,我希望将每个客户端放在一个唯一的标签中,而不是基于这2个表。 例如client.no_of_months> label.table.no_of_months,client.value_of_client> label.client.value_of_client然后是一个标签,但是如果客户是钻石,我如何说上位我需要每个客户都在他的首选标签中,输出将是钻石,而不是钻石,金,银,青铜,即使他也可以在该标签中。
答案 0 :(得分:0)
我想您可以在下面的查询中尝试-
SELECT customer_id, customer_name, label_name
FROM (SELECT k.customer_id,
k.customer_name,
l.label_name,
ROW_NUMBER() OVER(PARTITION BY k.customer_id ORDER BY l.value_of_client DESC) RN
FROM label_table l
inner JOIN client k ON k.value_of_client>l.value_of_client)
WHERE RN = 1
ORDER BY 1;
答案 1 :(得分:0)
public void start(Stage primaryStage) {
HBox hBox = new HBox();
Button circle = new Button("Circle");
Button square = new Button("Square");
Button red = new Button("Red");
Button blue = new Button("Blue");
hBox.getChildren().addAll(circle, square, red, blue);
Rectangle Square = new Rectangle();
square.setOnAction(e -> {
Square.setX(200);
Square.setY(200);
Square.setHeight(75);
Square.setWidth(75);
});
Circle Circle1 = new Circle();
red.setOnAction(e -> {
Square.setFill(Color.RED);
Circle1.setFill(Color.RED);
});
blue.setOnAction(e -> {
Square.setFill(Color.BLUE);
Circle1.setFill(Color.BLUE);
});
circle.setOnAction(e -> {
Circle1.setCenterX(100);
Circle1.setCenterY(100);
Circle1.setRadius(45);
});
BorderPane borderPane = new BorderPane();
borderPane.getChildren().addAll(Square, Circle1, hBox);
Scene scene = new Scene(borderPane, 600, 500);
primaryStage.setTitle("ShowBorderPane");
primaryStage.setScene(scene);
primaryStage.show();
}
}