|
If there are two pieces of data with the same price in Table B, how to display only one
Table B
--------------
ID AID PRICE
1 1 30
2 1 32
3 1 26
4 1 26
------------------------------------------
donkey_ngacnis right
So the algorithm is improved to
select top 1 with ties A.id, A.name, B.id, B.AID, B.price
from @B B
join @A A on A.id=B.AID
order by price
I guarantee fast and accurate |
|