Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 SQL Distinct

Author  Topic 

bb888
Starting Member

1 Post

Posted - 2010-03-02 : 05:04:49
Please could you tell me the SQL Command to reach the following
Thank you very much.


Orginal
Bez Preis VonNr BisNr
A 5 1 7
B 6 8 12
A 5 7 15
B 6 12 22
B 7 98 103
B 7 103 122


New
Bez Preis VonNr BisNr
A 5 1 15
B 6 8 22
B 7 98 122

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-03-02 : 05:13:29
Try this:
select
Bez,
Preis,
min(VonNr) as VonNr,
max(BisNr) as BisNr
from table
group by
Bez, Preis


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -