SELECT "PointName" AS "PointName",
"MeasurementDate2" AS "MeasurementDate2",
"MeasurementDate1" AS "MeasurementDate1",
DATE_TRUNC('day', td) AS td,
"PartNo" AS "PartNo",
"SerialNo" AS "SerialNo",
"Specification" AS "Specification",
"ToleranceUp" AS "ToleranceUp",
"ToleranceDown" AS "ToleranceDown",
min("PointData") AS "MIN(PointData)"
FROM "OA"."ThreeD"."MaxAndMinTable"
GROUP BY "PointName",
"MeasurementDate2",
"MeasurementDate1",
DATE_TRUNC('day', td),
"PartNo",
"SerialNo",
"Specification",
"ToleranceUp",
"ToleranceDown"
ORDER BY "MIN(PointData)" ASC
LIMIT 10000;
the above query is generated automatically by superset tool, after then show error Expression 'MaxAndMinTable.td' is not being grouped.
if i revised it to whether of below, it works.
SELECT "PointName" AS "PointName",
"MeasurementDate2" AS "MeasurementDate2",
"MeasurementDate1" AS "MeasurementDate1",
DATE_TRUNC('day', td) AS td2,
"PartNo" AS "PartNo",
"SerialNo" AS "SerialNo",
"Specification" AS "Specification",
"ToleranceUp" AS "ToleranceUp",
"ToleranceDown" AS "ToleranceDown",
min("PointData") AS "MIN(PointData)"
FROM "OA"."ThreeD"."MaxAndMinTable"
GROUP BY "PointName",
"MeasurementDate2",
"MeasurementDate1",
DATE_TRUNC('day', td),
"PartNo",
"SerialNo",
"Specification",
"ToleranceUp",
"ToleranceDown"
ORDER BY "MIN(PointData)" ASC
LIMIT 10000;
or
SELECT "PointName" AS "PointName",
"MeasurementDate2" AS "MeasurementDate2",
"MeasurementDate1" AS "MeasurementDate1",
DATE_TRUNC('day', td) AS td,
"PartNo" AS "PartNo",
"SerialNo" AS "SerialNo",
"Specification" AS "Specification",
"ToleranceUp" AS "ToleranceUp",
"ToleranceDown" AS "ToleranceDown",
min("PointData") AS "MIN(PointData)"
FROM "OA"."ThreeD"."MaxAndMinTable"
GROUP BY "PointName",
"MeasurementDate2",
"MeasurementDate1",
td,
"PartNo",
"SerialNo",
"Specification",
"ToleranceUp",
"ToleranceDown"
ORDER BY "MIN(PointData)" ASC
LIMIT 10000;