仅获取具有多个图像和标签的单行

时间:2019-04-10 07:53:48

标签: sql hibernate hql

我正在使用以下Hibernate Query Language(HQL)查询从多个表中获取数据

method:
  const selectedCollegeHandler = (event, data) => {
    setSelectedCollege((prevState) => {
      return data.value
    });
  }

如果帖子中包含多个图像和标签,则同一消息会多次显示,而我只想显示一次。

更新时

                ( " select distinct post, "
                + "from Post as post "
                + "left join fetch post.user as postUser "
                + "left join fetch post.postTags as tags "
                + "left join fetch post.postMessages as postmessage  "
                + "left join fetch postmessage.postImageses as postImages  "
                + "where post.id=:msgId "

                + "order by post.adddate desc")

( " select distinct post, " + "from Post as post " + "left join fetch post.user as postUser " + "left join fetch post.postTags as tags " + "left join fetch post.postMessages as postmessage " + "left join fetch postmessage.postImageses as postImages " + "where post.id=:msgId " +"order by post.id " + "order by post.adddate desc") 仅显示一张图片以解决此问题

0 个答案:

没有答案