计算最大价格。。。
来源:互联网 发布:淘宝客服术语模板 编辑:程序博客网 时间:2024/04/28 11:00
准备的表与数据:
mysql> desc shop ;
+---------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+-------+
| article | varchar(20) | YES | | NULL | |
| dealer | char(1) | YES | | NULL | |
| price | double | YES | | NULL | |
+---------+-------------+------+-----+---------+-------+
mysql> select * from shop;
+---------+--------+-------+
| article | dealer | price |
+---------+--------+-------+
| 0001 | D | 20.5 |
| 0002 | C | 11.5 |
| 0003 | F | 81.5 |
+---------+--------+-------+
方式1:
mysql> select s1.* from shop s1 left join shop s2 on s1.price <s2.price where s2.article is null;
+---------+--------+-------+
| article | dealer | price |
+---------+--------+-------+
| 0003 | F | 81.5 |
+---------+--------+-------+
方式2:
mysql> select * from shop s1 where price = (select max(price) from shop s2);
+---------+--------+-------+
| article | dealer | price |
+---------+--------+-------+
| 0003 | F | 81.5 |
+---------+--------+-------+
方式3:
mysql> select * from shop order by price desc limit 1;
+---------+--------+-------+
| article | dealer | price |
+---------+--------+-------+
| 0003 | F | 81.5 |
+---------+--------+-------+
- 计算最大价格。。。
- 计算价格
- 页面计算价格例子
- 价格弹性的计算()
- FOB价格计算
- 晶圆价格计算
- 高精度价格计算、格式化
- 价格的计算---BigDecimal
- 价格计算工具类
- hdu1070 计算牛奶价格
- jquery 动态计算价格
- SAP作业价格计算
- 远期外汇价格的计算
- 【ACM之旅】计算价格
- 购物车数量价格计算
- app开发价格如何计算?
- 刷清橙OJ--A1017.计算价格
- 购物车,计算价格,tian
- css 类选择器 id选择器 html选择器 通配符选择器 父子选择器
- hdu 5229 ZCC loves strings
- 网银支付接口资料小总
- Git常用命令
- Swap Nodes in Pairs
- 计算最大价格。。。
- 数据挖掘十大经典算法
- urllib2使用总结
- IOS 开发学习十五 自定义控件
- iOS中如何自定义加密缓存及缓存原理分析(第一节:缓存原理分析)
- 使用sql*plus输出xls和html两种格式文件
- Python写爬虫——抓取网页并解析HTML
- C语言 gets()和scanf()函数的区别
- VC++ 通过进程名或进程ID获取进程句柄