日期:2014-05-18  浏览次数:20706 次

请问这样的sql语句怎么写成hql啊,多谢
select   count(*)   from   orderlist   where   orderlist.OrderId   =   (select   ord_Id   from   orderpro     where   orderpro.UserId   =   37

用的mysql数据库,有orderlist,orderpro2张表,orderlist.OrderId与orderpro.ord_Id   一样,并且orderpro.UserId   =   37

------解决方案--------------------
select count(o1) from orderlist o1,orderpro o2 where o1.OrderId=o2.ord_Id and o2.UserId =37 //如果两个表没有关联的话