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.
Author |
Topic |
THM
Starting Member
4 Posts |
Posted - 2011-11-04 : 12:08:19
|
Dear all,i'm not sure that this is can be done but what i want to do is consolidate data in my database the following data is held in the SAMPLE table. I want to consolidate entrys based on rocktype. so that is to entry next to each other have the same rock type there they can become one entry with the FROM from the first and the TO from the second. see bellow. I'm not sure if this can be done with SQL, any help will be great. holeid projectcode from to rocktypesl1 test 1 2 dolsl1 test 2 4 dolsl1 test 4 7 mpysl1 test 7 8 mpysl2 test 1 2 fossl2 test 2 3 fossl2 test 3 50 mpy I would like to look like this.... holeid projectcode from to rocktypesl1 test 1 4 dolsl1 test 4 8 mpysl2 test 1 3 fossl2 test 3 50 mpy |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-11-04 : 12:58:13
|
[code]select holeid,projectcode,min(from) as from,max(to) as to,rocktypefrom tablegroup by holeid,projectcode,rocktype[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|