SELECT
PropertyId AS '房源编号',
Price AS '最新售价'
FROM
(
SELECT
row_number ( ) OVER ( partition BY PropertyId ORDER BY UpShelfStartDate DESC ) AS rownum,
PropertyId,
Price,
UpShelfStartDate
FROM
PropertyEffective
WHERE
PropertyId IN (
'5674192',
'1586090',
'9239671'
)
AND TradeTypeFlg = 1
AND Price IS NOT NULL
) tempA
WHERE
tempA.rownum = 1