SQL 在 salesforce 上不适用
SQL on salesforce not applicable
我在 SQL 上有此代码,我正尝试在 Salesforce 中使用它。我收到一个错误,它无法识别 JOIN 函数。
代码如下:
SELECT
lu_table.Name,
lu_table.id,
primary.Start_date,
primary.end_date,
secondary.metric
FROM primary
LEFT JOIN secondary
ON primary.xyz= secondary.xyz
LEFT JOIN lu_table
ON primary.id = lu_table.id
group by lu_table.Name;
Salesforce 有自己的查询语言 SOQL。该语言没有 JOIN
功能。这是 reference
SOQL 语法:
SELECT fieldList [subquery][...]
[TYPEOF typeOfField whenExpression[...] elseExpression END][...]
FROM objectType[,...]
[USING SCOPE filterScope]
[WHERE conditionExpression]
[WITH [DATA CATEGORY] filteringExpression]
[GROUP BY {fieldGroupByList|ROLLUP (fieldSubtotalGroupByList)|CUBE (fieldSubtotalGroupByList)}
[HAVING havingConditionExpression] ]
[ORDER BY fieldOrderByList {ASC|DESC} [NULLS {FIRST|LAST}] ]
[LIMIT numberOfRowsToReturn]
[OFFSET numberOfRowsToSkip]
[FOR {VIEW | REFERENCE}[,...] ]
[ UPDATE {TRACKING|VIEWSTAT}[,...] ]
编辑
你用 SOQL 查询就差不多了。
SELECT
Start_date,
end_date,
(SELECT Id, Name FROM lu_table),
(SELECT metric FROM secondary)
FROM primary
WHERE xyz IN (SELECT xyz FROM secondary WHERE condition)
AND Id IN (SELECT id FROM lu_table WHERE condition)
GROUP BY lu_table.Name;
但我不确定这种形式的查询是否会达到 SF 限制
我在 SQL 上有此代码,我正尝试在 Salesforce 中使用它。我收到一个错误,它无法识别 JOIN 函数。
代码如下:
SELECT
lu_table.Name,
lu_table.id,
primary.Start_date,
primary.end_date,
secondary.metric
FROM primary
LEFT JOIN secondary
ON primary.xyz= secondary.xyz
LEFT JOIN lu_table
ON primary.id = lu_table.id
group by lu_table.Name;
Salesforce 有自己的查询语言 SOQL。该语言没有 JOIN
功能。这是 reference
SOQL 语法:
SELECT fieldList [subquery][...]
[TYPEOF typeOfField whenExpression[...] elseExpression END][...]
FROM objectType[,...]
[USING SCOPE filterScope]
[WHERE conditionExpression]
[WITH [DATA CATEGORY] filteringExpression]
[GROUP BY {fieldGroupByList|ROLLUP (fieldSubtotalGroupByList)|CUBE (fieldSubtotalGroupByList)}
[HAVING havingConditionExpression] ]
[ORDER BY fieldOrderByList {ASC|DESC} [NULLS {FIRST|LAST}] ]
[LIMIT numberOfRowsToReturn]
[OFFSET numberOfRowsToSkip]
[FOR {VIEW | REFERENCE}[,...] ]
[ UPDATE {TRACKING|VIEWSTAT}[,...] ]
编辑
你用 SOQL 查询就差不多了。
SELECT
Start_date,
end_date,
(SELECT Id, Name FROM lu_table),
(SELECT metric FROM secondary)
FROM primary
WHERE xyz IN (SELECT xyz FROM secondary WHERE condition)
AND Id IN (SELECT id FROM lu_table WHERE condition)
GROUP BY lu_table.Name;
但我不确定这种形式的查询是否会达到 SF 限制