select a.*,b.name from t_price a inner join t_product b on
b.id = a.p_id
where not exists(select 1 from t_price
where a.p_id=p_id and a.price>price or
(a.price=price and a.quantity<quantity)
)
解决方案 »
- 使用JAVA向MYSQL的BLOB类型,插入一个大文件,如何解决OutOfMemoryError问题!
- 为什么同样的表却建立失败了
- disuz数据库查询问题
- 求mysql语句!已知当前时间戳,求表中所有在本星期的数据
- 请问在设置MYSQL5。0支持UTF-8的时候,哪些参数是必须设置的?
- 请教mysql存储过程中涉及到limit,该如何写?
- MySQL4.0.16导出的文件,导入到另一台同版本数据库就导不进去了!!!
- mysql登陆出现问题.请各位帮忙,急!~~~~
- 请教:mysql for win98及win2000的下载地址
- 2,3个字段的表,数据量大了,需要分表吗?
- 建立*.sql文件 不能导入mysql数据库 帮忙给看看
- 为啥建表总是不成功!帮忙看看!
b.id = a.p_id
where not exists(select 1 from t_price
where a.p_id=p_id and (a.price>price or
(a.price=price and a.quantity<quantity)
))
[征集]分组取最大N条记录方法征集,及散分....
from t_price a
where not exists (select 1 from t_price where p_id=a.p_id and (price<a.price or (price=a.price and quantity>a.quantity)))
select a.name,b.p_id,b.retailer_id,price,quantity
from t_product a inner join t_price b on a.id=b.p_id
order by b.p_id,price,quantity desc
) x
group by name
from t_price a
where not exists (select 1 from t_price where p_id=a.p_id and (price<a.price or (price=a.price and quantity>a.quantity)))