select max(fsid) from com.zycloud.model.TbFunctionSon  group by tbFunctionFather 这样写为什么不对啊 请大侠帮帮啊

解决方案 »

  1.   

    hql from后面类名  无需com.zycloud.model.TbFunctionSon 
      

  2.   

    select max(fsid) from TbFunctionSon tb group by tb.tbFunctionFather
      

  3.   

    我认为应该这样写 select max(fsid) from TbFunctionSon tb group by tb.tbFunctionFather 
      

  4.   

    select max(tb.fsid),tb.tbFunctionFather from TbFunctionSon tb group by tb.tbFunctionFather 
      

  5.   

    select max(fsid) from TbFunctionSon group by tbFunctionFather 
      

  6.   

    select max(fsid) from com.zycloud.model.TbFunctionSon group by tbFunctionFather  
    报什么错,fsid,tbFunctionFather  为字段,这样写实没有问题的
      

  7.   

    其实楼主写的并没错,建议这样写:select max(fsid)TbFunctionSon group by tbFunctionFather 或者
    select max(tf.fsid)TbFunctionSon tf group by tf.tbFunctionFather
    要保证表名和字段名与实体类名和实体类中对应字段名一样(包括大小写)。
    应该没什么问题,如还有问题,把报的错误信息贴出来大家分析一下。
    祝你好运咯!
      

  8.   

    补充一下,刚才着急忽略一点:建议这样写:select max(fsid)from TbFunctionSon group by tbFunctionFather 或者
    select max(tf.fsid)from TbFunctionSon tf group by tf.tbFunctionFather
    忘写from了。祝你好运!