/**
* 功能:根据品牌查询
*
* @param pageSize
* 每页大小
* @param currentLPagem
* 当前第几页
* @param productBlack
* 产品品牌
* @param productBlackItem
* 产品分类
* @param productSize
* 产品尺码
* @param keyWord
* 搜索关键字
* @return
*/
public pageBean seachProductByBrank(int pageSize, int currentLPage,
String product_Brank, String product_itemName) {
// final String hql = "from " + OgrilProducts.class.getName()
// + " where product_Brank='" + product_Brank
// + "' and product_itemName='" + product_itemName
// + "' order by product_registerDate desc";
final String hql = " from "
+ OgrilProducts.class.getName()
+ " as product where product.productItemName='"
+ product_itemName
+ "' and productBrank='"
+ product_Brank
+ "' and not exists( from "
+ OgrilProducts.class.getName()
+ " where productItemName='"
+ product_itemName
+ "' and productBrank='"
+ product_Brank
+ "' and productItemNumber=product.productItemNumber and productId
你这不是去除重复数据了吗?
distinct 本身就是一种去重复方法
也可以使用group by
--只获取分组为一条数据数据
select car
from car
group by car
having count(car)=1
很明显grouy by 灵活度更高
希望对你有帮助