acquisitionID Logno. FundName
1 2 Allocated
1 2 Potential
2 34 Allocated
3 37 Potential
4 40 Allocated
4 40 Potential
5 39 Potential
我想只显示那些有FundName为Allocated的行,如果有两个基金,即(Allocated / Potential),否则我想按原样显示它。即。
acquisitionID Logno. FundName
1 2 Allocated
2 34 Allocated
3 37 Potential
4 40 Allocated
5 39 Potential
答案 0 :(得分:1)
SELECT AcquisitionID, [LogNo.], min(FundName)
FROM myTable
GROUP BY AcquisitionID, [LogNo.]