| Author |
Topic |
|
jhon11
Starting Member
42 Posts |
Posted - 2008-04-10 : 10:33:58
|
| hello All,It is kind of easy one but for me it seems difficult and I cant think of itmy results are likeID column1 column2 column3 1 15 null null 1 null 6 null 1 null null 9desired resultsID col1 col2 col31 15 6 9thanks, |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-04-10 : 10:35:57
|
SELECT ID, MAX(Column1), MAX(Column2), MAX(Column3)FROM Table1GROUP BY ID E 12°55'05.25"N 56°04'39.16" |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-04-10 : 10:36:05
|
| select id,max(column1) as col1,max(column2) as col2,max(column3) as col3 from your_tablegroup by idMadhivananFailing to plan is Planning to fail |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-04-10 : 10:36:14
|
[code]select ID, max(col1) as col1, max(col2) as col2, max(col3) as col3from tablegroup by ID[/code]Double Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-04-10 : 10:37:12
|
 E 12°55'05.25"N 56°04'39.16" |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-04-10 : 10:39:24
|
quote: Originally posted by harsh_athalye Double 
again! E 12°55'05.25"N 56°04'39.16" |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-04-10 : 10:40:38
|
Yes, I am bored right now  E 12°55'05.25"N 56°04'39.16" |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-04-10 : 10:41:24
|
MadhivananFailing to plan is Planning to fail |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-04-10 : 10:41:50
|
quote: Originally posted by Peso
 E 12°55'05.25"N 56°04'39.16"
How can you be sniped Peter? You were the first to reply, so we are sniped by you! Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-04-10 : 10:43:41
|
Well, I am bored right now and don't much else to do.Have been running an UPDATE statement for 13 hours now... E 12°55'05.25"N 56°04'39.16" |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-04-10 : 10:44:25
|
Me too. Waiting for an Autosys job to be finished. Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-04-11 : 04:07:18
|
quote: Originally posted by Peso Well, I am bored right now and don't much else to do.Have been running an UPDATE statement for 13 hours now... E 12°55'05.25"N 56°04'39.16"
How big is the table?MadhivananFailing to plan is Planning to fail |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-04-11 : 07:05:21
|
Only 25 million records. But updated have to run about 320 times... E 12°55'05.25"N 56°04'39.16" |
 |
|
|
soorajtnpki
Posting Yak Master
231 Posts |
Posted - 2008-04-11 : 08:16:10
|
| if ur table has only the records belowID column1 column2 column31 15 null null1 null 6 null1 null null 9then for ur result, try...its null magicselect id,min(column1) as col1,avg(column2) as col2,max(column3) as col3 from your_tablegroup by idokthanks...... |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-04-11 : 08:24:31
|
| How it is different from the solutions posted above? and why min(), avg() and max()?Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
soorajtnpki
Posting Yak Master
231 Posts |
Posted - 2008-04-11 : 08:34:53
|
| hi its same idea and gives same result. but in a fancy way... but it is only applicable for sample data of above pattern....ok |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-04-11 : 08:34:54
|
quote: Originally posted by harsh_athalye How it is different from the solutions posted above? and why min(), avg() and max()?Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED"
Becuase that solution is specific to that data onlyMadhivananFailing to plan is Planning to fail |
 |
|
|
soorajtnpki
Posting Yak Master
231 Posts |
Posted - 2008-04-11 : 08:35:55
|
| yes madhi u r right...okk |
 |
|
|
|