只是想知道将相关字段添加到select语句的正确语法是什么。示例员工都有一个部门,该部门在Employee表的departmentID字段中设置。如果我想撤回所有员工但只想显示他们的FirstName和DepartmentName,那么OData select语法是什么?我以为它会像http://example.com/odata.svc/Employees?$ select = FirstName,+ Department.DepartmentName
答案 0 :(得分:3)
语法为:http://mywebsite.com/odata.svc/Employees?$select=FirstName,Department/DepartmentName&$expand=Department
Stack Overflow的OData API的相关(工作)示例如下: http://odata.stackexchange.com/stackoverflow/atom/Users?$select=DisplayName,Badges/Name&$expand=Badges