ODBC guide

List work items with ParentId


By default, relation fields such as ParentId are not returned so that list queries stay fast. When you need parent-child or other link information, set Expand='Relations' in the WITH clause. The result set will then include ParentId and other relation columns so you can join or filter by hierarchy.

SELECT * FROM WorkItems WITH(Expand='Relations')