HQL select 一个实体的属性通过连接两个表
HQL select properties of one entity by joining two tables
我有两个table
first table (people):id ,name;
second table (relation):id,parent_id,child_id
第二个 table 包含第一个 table 对象之间的父链接。很简单))
通过此查询,我从 tables
中获取了所有字段
from People AS people , Relation as relation WHERE relation.parent_id=XXX AND people.id=relation.child_id
如何只从第一个 table 获取字段?
select people from People AS people , Relation as relation WHERE relation.parent_id=XXX AND people.id=relation.child_id
我有两个table
first table (people):id ,name;
second table (relation):id,parent_id,child_id
第二个 table 包含第一个 table 对象之间的父链接。很简单))
通过此查询,我从 tables
中获取了所有字段from People AS people , Relation as relation WHERE relation.parent_id=XXX AND people.id=relation.child_id
如何只从第一个 table 获取字段?
select people from People AS people , Relation as relation WHERE relation.parent_id=XXX AND people.id=relation.child_id