带查询的内部短划线SQL查询内部连接

问题描述 投票:0回答:1

我正在使用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个回答
1
投票

您可以尝试替换"BrandProfile" with 'BrandProfile'。也建议阅读When to use single quotes, double quotes, and backticks in MySQL一文,其中介绍了ANSI_QUOTES模式的行为。

© www.soinside.com 2019 - 2024. All rights reserved.