Domanda

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);
È stato utile?

Soluzione

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 ;-)

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top