2021-09-12 12:35:27 +00:00
|
|
|
-- Tags: no-parallel
|
|
|
|
|
2020-11-11 15:29:36 +00:00
|
|
|
DROP DATABASE IF EXISTS test_01392;
|
|
|
|
CREATE DATABASE test_01392;
|
2020-07-14 09:34:47 +00:00
|
|
|
|
2020-11-11 15:29:36 +00:00
|
|
|
CREATE TABLE test_01392.tableConversion (conversionId String, value Nullable(Double)) ENGINE = Log();
|
|
|
|
CREATE TABLE test_01392.tableClick (clickId String, conversionId String, value Nullable(Double)) ENGINE = Log();
|
|
|
|
CREATE TABLE test_01392.leftjoin (id String) ENGINE = Log();
|
2020-07-14 09:34:47 +00:00
|
|
|
|
2020-11-11 15:29:36 +00:00
|
|
|
INSERT INTO test_01392.tableConversion(conversionId, value) VALUES ('Conversion 1', 1);
|
|
|
|
INSERT INTO test_01392.tableClick(clickId, conversionId, value) VALUES ('Click 1', 'Conversion 1', 14);
|
|
|
|
INSERT INTO test_01392.tableClick(clickId, conversionId, value) VALUES ('Click 2', 'Conversion 1', 15);
|
|
|
|
INSERT INTO test_01392.tableClick(clickId, conversionId, value) VALUES ('Click 3', 'Conversion 1', 16);
|
2020-07-14 09:34:47 +00:00
|
|
|
|
|
|
|
SELECT
|
|
|
|
conversion.conversionId AS myConversionId,
|
|
|
|
click.clickId AS myClickId,
|
|
|
|
click.myValue AS myValue
|
|
|
|
FROM (
|
|
|
|
SELECT conversionId, value as myValue
|
2020-11-11 15:29:36 +00:00
|
|
|
FROM test_01392.tableConversion
|
2020-07-14 09:34:47 +00:00
|
|
|
) AS conversion
|
|
|
|
INNER JOIN (
|
|
|
|
SELECT clickId, conversionId, value as myValue
|
2020-11-11 15:29:36 +00:00
|
|
|
FROM test_01392.tableClick
|
2020-07-14 09:34:47 +00:00
|
|
|
) AS click ON click.conversionId = conversion.conversionId
|
|
|
|
LEFT JOIN (
|
2020-11-11 15:29:36 +00:00
|
|
|
SELECT * FROM test_01392.leftjoin
|
2020-07-14 09:34:47 +00:00
|
|
|
) AS dummy ON (dummy.id = conversion.conversionId)
|
|
|
|
ORDER BY myValue;
|
|
|
|
|
2020-11-11 15:29:36 +00:00
|
|
|
DROP TABLE test_01392.tableConversion;
|
|
|
|
DROP TABLE test_01392.tableClick;
|
|
|
|
DROP TABLE test_01392.leftjoin;
|
|
|
|
|
|
|
|
DROP DATABASE test_01392;
|