I have two entities: Cars (ownerId->String) and Users (userId->String), where ownerId is the foreign key representing userId.

I am trying to execute this Query, but I get "GQL syntax" at Datastore Viewer. How can I do this SUBSELECT?

SELECT * FROM Cars WHERE ownerId IN (SELECT userId FROM Users);
有帮助吗?

解决方案

You can't. GQL is not SQL.

You will need to to do one select, then iterate and fetch/filter or do two selects and merge in code.

Alternately add a flag in the Car object that tells you that the Owner is a User, then you don't need to

If you are not trying to write code, but just explore then the remote_api shell is a place to try these things. Though this is much easier in python ;-)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top