LEFT JOIN 时的情况?
CASE WHEN with LEFT JOIN?
我想 select 左连接 table 取决于来自其他 table 的值。
所以我尝试了这个,但没有用:
CASE WHEN c.catId LIKE "%s%" THEN
LEFT JOIN AppBundle:newspaper_subcategories cat WITH c.catIdShort = cat.id
ELSE
LEFT JOIN AppBundle:newspaper_categories cat WITH c.catIdShort = cat.id
END
简单地左连接两个表,但在列子句上使用 CASE 语句
SELECT
. . .
CASE WHEN c.catId LIKE '%s%'
THEN sub.somecolumn
ELSE cat.somecolumn
END
. . .
LEFT JOIN AppBundle:newspaper_subcategories sub ON c.catIdShort = cat.id
LEFT JOIN AppBundle:newspaper_categories cat ON c.catIdShort = cat.id
我想 select 左连接 table 取决于来自其他 table 的值。 所以我尝试了这个,但没有用:
CASE WHEN c.catId LIKE "%s%" THEN
LEFT JOIN AppBundle:newspaper_subcategories cat WITH c.catIdShort = cat.id
ELSE
LEFT JOIN AppBundle:newspaper_categories cat WITH c.catIdShort = cat.id
END
简单地左连接两个表,但在列子句上使用 CASE 语句
SELECT
. . .
CASE WHEN c.catId LIKE '%s%'
THEN sub.somecolumn
ELSE cat.somecolumn
END
. . .
LEFT JOIN AppBundle:newspaper_subcategories sub ON c.catIdShort = cat.id
LEFT JOIN AppBundle:newspaper_categories cat ON c.catIdShort = cat.id