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 > Sum problems

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-14-04, 08:48
Td04 Td04 is offline
Registered User
 
Join Date: Mar 2004
Posts: 52
Question Sum problems

I try to make som multiple summating from an Oracle database with a ASP page.
I would like to summate the area of different landtypes and hava 3 columns of interest. landtype, area and place .
So I am struggeling with the SQL statements..
If possible I would like all of the landtypes summed separately in a single SQL statement.
So If I chose the place redden
I get a result of
gras area 7
water area 15
farmland area 25
and so on.
I tried this below but it dont seem to work
Is it possible to write sth like this? or should one use some type of group statement?

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

and then have the recordsets printed out sth

<%
rs.movefirst
do while not rs.eof
<TR>
<TD><%=rs("gras")%><TD>
</TR>
<TR>
<TD><%=rs("water")%><TD>
</TR>
<TR>
<TD><%=rs("farmland")%><TD>
</TR>
<%
rs.movenext
loop
%>

Thanks//Martin
__________________
"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