문제

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