General discussion
July 17, 2004 at 04:01 AM
fmian20

question t-sql

by fmian20 . Updated 22 years ago

Id Numb
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
.. ..
.. ..
.. ..
.. .

Say I want to select max and min numb and there ids from above tabl in single select statement e.x select min(numb) ,id –(id for that (min (numb)))
,max(numb),id –(id for that (max (numb)))
from tabl –actual table is consist of 100000 number so how can we achieve it in single select statement.

Question2nd:
If I want sum for first five numb and sum for next 5 numb, and sum of next 5 numb ?.so on? and then sum of those sums and there id
How it can be done

Bit unusual question but see how we go?

This discussion is locked

All Comments