【问题标题】:redash SQL query inner join with query用查询重划 SQL 查询内部联接
【发布时间】:2020-05-05 12:54:45
【问题描述】:

我正在使用 redash 来显示数据,并且正在努力弄清楚如何仅显示此连接查询的特定图像。

问题在于我的最后一个 AND 条件似乎破坏了查询 (AND "images"."imageable_type" = "BrandProfile")。以下是我收到的错误消息。

Error running query: column "BrandProfile" does not exist LINE 31: ...s"."height" = 760 AND "images"."imageable_type" = "BrandProf... ^


SELECT "brand_profiles"."company_name",
       "users"."full_name",
       "brand_profiles"."location",
       "brand_profiles"."company_website",
       "brand_profiles"."description",
       "images"."processed_url"
FROM "brand_profiles"
INNER JOIN "users" ON "users"."id" = "brand_profiles"."user_id"
INNER JOIN "images" ON "images"."imageable_id" = "brand_profiles"."id" AND "images"."height" = 760 AND "images"."imageable_type" = "BrandProfile"
WHERE "brand_profiles"."deleted_at" IS NULL
  AND "brand_profiles"."marketplace" = true

【问题讨论】:

    标签: mysql sql postgresql inner-join redash


    【解决方案1】:

    您可以尝试替换"BrandProfile" with 'BrandProfile'。还建议阅读When to use single quotes, double quotes, and backticks in MySQL 的帖子,该帖子解释了ANSI_QUOTES 模式的行为。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-03-19
      • 1970-01-01
      • 1970-01-01
      • 2013-07-28
      • 1970-01-01
      • 2018-08-06
      • 2013-11-18
      相关资源
      最近更新 更多