All Downloads are FREE. Search and download functionalities are using the official Maven repository.

redshiftTableauQueries.13.sql Maven / Gradle / Ivy

There is a newer version: 0.5.8
Show newest version
SELECT COUNT(DISTINCT "customer"."c_custkey") AS "ctd_c_custkey_ok",
  "t0"."__measure__0" AS "calculation_1361031105746580"
FROM "tpch10g"."customer" "customer"
  INNER JOIN (
  SELECT COUNT((CASE WHEN ((0 < STRPOS("orders"."o_comment",CAST('special' AS TEXT))) AND (0 < (CASE
  	WHEN STRPOS("orders"."o_comment",CAST('special' AS TEXT)) IS NULL THEN NULL
  	WHEN 0 = STRPOS(SUBSTRING("orders"."o_comment",INT4LARGER(1,CAST(FLOOR(STRPOS("orders"."o_comment",CAST('special' AS TEXT))) AS INTEGER))),CAST('requests' AS TEXT)) THEN 0
  	ELSE (STRPOS(SUBSTRING("orders"."o_comment",INT4LARGER(1,CAST(FLOOR(STRPOS("orders"."o_comment",CAST('special' AS TEXT)))AS INTEGER))),CAST('requests' AS TEXT)) + INT4LARGER(1,CAST(FLOOR(STRPOS("orders"."o_comment",CAST('special' AS TEXT))) AS INTEGER)) - 1)	END))) THEN NULL ELSE "orders"."o_orderkey" END)) AS "__measure__0",
    "customer"."c_custkey" AS "c_custkey"
  FROM "tpch10g"."orders" "orders"
    RIGHT JOIN "tpch10g"."customer" "customer" ON ("orders"."o_custkey" = "customer"."c_custkey")
  GROUP BY 2
) "t0" ON (("customer"."c_custkey" = "t0"."c_custkey") OR (("customer"."c_custkey" IS NULL) AND ("t0"."c_custkey" IS NULL)))
GROUP BY 2




© 2015 - 2025 Weber Informatics LLC | Privacy Policy