翛然dl 2017-11-15 02:02 采纳率: 100%
浏览 2184
已采纳

hibernate多表关联查询

情景是这样的 有3张表  教师表 teacher; 学历表edutation(外键teacher_id是教师表的id)  ;  文章表article(外键teacher_id是教师表的id)  
现在我如何通过 文章标题title,文章内容content,第一学历first_edutation,第二学历last_edutation等信息确定教师或者教师列表(查询条件是随机的任意几个)

  • 写回答

3条回答 默认 最新

  • WX_JosephDj 2017-11-15 02:43
    关注

    试下这个.欢迎指导
    select t.teacher_id from teacher t where t.teacher_id in
    (
    (select e.teacher_id from edutation e where e.first_edutation='1' and e.last_edutation='2 )
    union
    (select a.teacher_id from article a where a.title='title' and a.content='content')
    )

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?