代码:
SELECT
ta_name,
countt,
ta_unit,
ta_id_producer_goods
FROM (
SELECT ta.name AS ta_name,
ta.unit AS ta_unit,
ta.id_producer_goods AS ta_id_producer_goods,
count(*) over(partition by ta.name) as countt,
ROW_NUMBER() over(partition by ta.name order by getdate()) as r
FROM Table ta
WHERE id_city = '24'
AND id_firm = '22131'
AND id_service = '5'
) x
WHERE r=1
当我在 SQL Server Management Studio 中运行上述查询时,我得到以下结果:
为什么我会得到错误编码的结果以及如何获得正确的编码?