This topic has been archived. It cannot be replied.
-
工作学习 / 学科技术讨论 / 请教个MS-SQL 语句.假设有张表有两个COLUM A 和 B, 现在选择Table 中 所有的记录, 如果 COLUM A 中的值相同, 只选择任意其中的一条记录。
Colum A, Colum B
1A 1B
2A 2B
2A 2B2
3A 3B
4A 4B
4A 4B2
5A 5B
结果
1A 1B
2A 2B
3A 3B
4A 4B
5A 5B
-bobo123(以马内利);
2008-1-2
{339}
(#4157542@0)
-
do a pivot first, then select the first two fields.
-madeinchina(强力万能胶);
2008-1-2
(#4157711@0)
-
select a, max(b) as b from my_table group by a;
-newkid(newkid);
2008-1-2
(#4157743@0)
-
谢了
-bobo123(以马内利);
2008-1-2
(#4157893@0)