Julio Cesar Sánchez González wrote:
A B wrote:
I have a table with rows like this
A 1
A 1
B 3
B 3
C 44
C 44
and so on.
and I want it to be
A 1
B 3
C 44
so how can I remove the all the duplicate lines but one?
You think this would help?
create table temp(text varchar(20),id integer );
INSERT INTO temp values('A',10);
INSERT INTO temp values('A',10);
INSERT INTO temp values('B',20);
INSERT INTO temp values('B',20);
INSERT INTO temp values('B',20);
select * from temp;
text | id
------+----
A | 10
A | 10
B | 20
B | 20
B | 20
select text,id, count(1) from temp group by 1,2; text | id | count
------+----+-------
A | 10 | 2
B | 20 | 3
and forget about the count from the result set.
--
Thanks & Regards
Kedar Parikh
Netcore Solutions Pvt. Ltd.
Tel: +91 (22) 6662 8135
Mob: +91 9819634734
Email: kedar@netcore.co.in
Web: www.netcore.co.in
===================================================================
sms START NEWS to 09845398453 for Breaking News and Top
Stories on Business, Sports & Politics. For more services visit
http://www.mytodaysms.com
===================================================================