If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Summing Problems

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-14-04, 09:01
Td04 Td04 is offline
Registered User
 
Join Date: Mar 2004
Posts: 52
Question Summing Problems

I have try to make multiple summatings from a oracle database with a ASP page.
But I got stuck withe the SQL statements.
I have 3 columns of interest. place area and landtype.
I would like to do all the summating in a single SLQ statemet.
And I want to get a result as if I coose the place redden
I get as a result
grass area = 10
water area = 15
farmland = 20
and so on.

I tried sth like below without success.
Is it possible or should one use some kind of group statement?

sql = "SELECT SUM(area) AS [grass]From databasetable where landtype='grass' AND place = 'redden' AND SUM(area) AS [water]From databasetable where landtype='water' AND place = 'redden' AND SUM(area) AS [farmland]From databasetable where landtype='farmland' AND place = 'redden'"

and then print out the recordsets as
<%
rs.movefirst
do while not rs.eof
%>
<TR>
<TD><%=rs("grass")%>
</TR>
<TR>
<TD><%=rs("water")%>
</TR>
<TR>
<TD><%=rs("farmland")%>
</TR>
<%
rs.movenext
loop
%>

Thanks//Martin
__________________
"Never underestimate a large number of morons"
Reply With Quote
  #2 (permalink)  
Old 04-14-04, 21:57
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
Hmmm, I could give you a method of doing this in MS SQL but not in Oracle I'm sorry.... and I'm pretty sure the MS SQL solution would not work in Oracle,... I would suggest posting a question in the Oracle forums and seeing if anyone can help with the SQL there...
Reply With Quote
  #3 (permalink)  
Old 04-15-04, 03:39
Td04 Td04 is offline
Registered User
 
Join Date: Mar 2004
Posts: 52
Quote:
Originally posted by rokslide
Hmmm, I could give you a method of doing this in MS SQL but not in Oracle I'm sorry.... and I'm pretty sure the MS SQL solution would not work in Oracle,... I would suggest posting a question in the Oracle forums and seeing if anyone can help with the SQL there...
How do I get the results printed out in the asp page?
the sum and so on
Do I get multiple Sums if I write like below and use group by?

select sum(column) AS RECORDSET

Thanks//Martin
__________________
"Never underestimate a large number of morons"
Reply With Quote
  #4 (permalink)  
Old 04-15-04, 09:37
Td04 Td04 is offline
Registered User
 
Join Date: Mar 2004
Posts: 52
I got it resolved...
__________________
"Never underestimate a large number of morons"
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On