Forums: » Register « |  Free Tools |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |

New Free Tools on Dev Shed!

#1
June 3rd, 2011, 03:54 AM
 swordsaint
Registered User

Join Date: Jun 2011
Posts: 4
Time spent in forums: 1 h 35 m 4 sec
Reputation Power: 0
Calculate on itself

hi,
only one table A(autoid, number)
how SELECT statment result: B(autoid, number, numberB)
numberB is sum of all the number have autoid > its autoid.
Thanks

#2
June 13th, 2011, 03:02 AM
 debasisdas
Humble Learner

Join Date: Jul 2007
Location: Bangalore, India
Posts: 280
Time spent in forums: 2 Months 3 Days 5 h 8 m 31 sec
Reputation Power: 119
If you have only one table A, then what is B ?

#3
June 13th, 2011, 01:34 PM
 LKBrwn_DBA
Contributing User

Join Date: Sep 2006
Posts: 817
Time spent in forums: 1 Week 18 h 23 m 3 sec
Reputation Power: 387

Quote:
 Originally Posted by swordsaint hi, only one table A(autoid, number) how SELECT statment result: B(autoid, number, numberB) numberB is sum of all the number have autoid > its autoid. Thanks

If you review your SQL 101 course, you will be able to easily answer this homework assignment.
__________________

#4
June 13th, 2011, 06:14 PM
 rpcm
Registered User

Join Date: Jun 2011
Posts: 2
Time spent in forums: 28 m 28 sec
Reputation Power: 0
from my head , something like this.....

Code:
```SELECT
A.AUTOID,
A.NUMBER,
(SELECT
SUM(B.NUMBER)
FROM
TABLEA B
WHERE
B.AUTOID>A.AUTOID) TOTAL
FROM
TABLEA A
```

#5
June 13th, 2011, 08:16 PM
 LKBrwn_DBA
Contributing User

Join Date: Sep 2006
Posts: 817
Time spent in forums: 1 Week 18 h 23 m 3 sec
Reputation Power: 387

Unfortunately you were given the answer and did not learn anything.

Some people do not understand the knowledge of the ages:

"Give a man a fish and he will eat one day, Teach a man to fish and he will have food every day"

clivew agrees!

 Viewing: Dev Shed Forums > Databases > Oracle Development > Calculate on itself