zond
zond

Reputation: 1480

HQL select properties of one entity by joining two tables

I have two tables

first table (people):id ,name;
second table (relation):id,parent_id,child_id

Second table contains parental links between objects from first table. Very simple ))

By this query I get all fields from both tables

from People AS people , Relation  as relation WHERE  relation.parent_id=XXX AND people.id=relation.child_id

how to get only field from first table?

Upvotes: 0

Views: 1054

Answers (1)

Dmitrii Bocharov
Dmitrii Bocharov

Reputation: 935

select people from People AS people , Relation  as relation WHERE  relation.parent_id=XXX AND people.id=relation.child_id

Upvotes: 1

Related Questions