主题:关于日期的查询,菜鸟问题,有时间的就帮帮忙
A表:
| X | Y | Z |
| 1 | 0.8 | 2005-01-02 |
| 1 | 0.8 | 2006-01-02 |
| 1 | 0.9 | 2007-01-05 |
| 1 | 1.8 | 2007-01-09 |
| 2 | 0.7 | 2005-01-02 |
| 3 | 3.8 | 2007-01-02 |
| 3 | 3.9 | 2007-01-10 |
| 4 | 1.2 | 2005-01-02 |
| 4 | 1.3 | 2007-01-03 |
| 4 | 1.6 | 2007-01-04 |
| 5 | 2.5 | 2005-01-08 |
| 5 | 2.8 | 2006-01-09 |
| 5 | 3.9 | 2007-01-10 |
| 6 | 6.5 | 2007-02-02 |
写个查寻语句,调出日期最新的X的Y值
题目说的不是很清楚
总之要使得查询的结果如下表:
| X | Y | Z |
| 1 | 1.8 | 2007-01-09 |
| 2 | 0.7 | 2005-01-02 |
| 3 | 3.9 | 2007-01-10 |
| 4 | 1.6 | 2007-01-04 |
| 5 | 3.9 | 2007-01-10 |
| 6 | 6.5 | 2007-02-02 |
不知道用什么函数,我用的是MS SQL。
| X | Y | Z |
| 1 | 0.8 | 2005-01-02 |
| 1 | 0.8 | 2006-01-02 |
| 1 | 0.9 | 2007-01-05 |
| 1 | 1.8 | 2007-01-09 |
| 2 | 0.7 | 2005-01-02 |
| 3 | 3.8 | 2007-01-02 |
| 3 | 3.9 | 2007-01-10 |
| 4 | 1.2 | 2005-01-02 |
| 4 | 1.3 | 2007-01-03 |
| 4 | 1.6 | 2007-01-04 |
| 5 | 2.5 | 2005-01-08 |
| 5 | 2.8 | 2006-01-09 |
| 5 | 3.9 | 2007-01-10 |
| 6 | 6.5 | 2007-02-02 |
写个查寻语句,调出日期最新的X的Y值
题目说的不是很清楚
总之要使得查询的结果如下表:
| X | Y | Z |
| 1 | 1.8 | 2007-01-09 |
| 2 | 0.7 | 2005-01-02 |
| 3 | 3.9 | 2007-01-10 |
| 4 | 1.6 | 2007-01-04 |
| 5 | 3.9 | 2007-01-10 |
| 6 | 6.5 | 2007-02-02 |
不知道用什么函数,我用的是MS SQL。