我正在使用 SQL Server。我使用了这段代码:
select distinct A.CustomerNo, A.INV_Nr, B.Code, A.Price
from INVOICE A.
INVOICE_LINE B
where
A.IVC_Nr = B.IVC_Nr
输出是这样的:
| CustomerNo | INV_Nr | Code | Price |
=================================================
| 1100021 | 500897 | 1404 | 2500 |
| 1100021 | 500897 | 1403 | 2500 |
| 1100022 | 500898 | 1405 | 3500 |
| 1100023 | 500899 | 1405 | 3000 |
| 1100023 | 500899 | 1403 | 3000 |
如何删除第二行并仅获取相同数字的第一行,应该是这样的:
| CustomerNo | INV_Nr | Code | Price |
=================================================
| 1100021 | 500897 | 1404 | 2500 |
| 1100022 | 500898 | 1405 | 3500 |
| 1100023 | 500899 | 1405 | 3000 |
谢谢,