Home > Ask the Oracle Experts > (Archive) SQL and PL/SQL Questions & Answers > Working with InterDev and DreamWeaver
Ask The Oracle Expert: Questions & Answers
EMAIL THIS

Working with InterDev and DreamWeaver

Azim Fahmi EXPERT RESPONSE FROM: Azim Fahmi

Pose a Question
Other Oracle Categories
Meet all Oracle Experts
Become an Expert for this site


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


>
QUESTION POSED ON: 04 February 2005
I am designing a Web application using InterDev and DreamWeaver that accesses an Oracle Table. I have an ASP page that runs a query of selected filters. The answers are then posted to a table on a results ASP page. I want to have report information that totals certain results of the query. for instance- Fields are INDEXPTS(numeric),MIR5P(varchar), STATUS(varchar), & TOTALCREDIT(numeric), ISSUETO(varchar).

If I query ISSUETO I may have several rows returned with various data from the other fields. It might look like this (under the column titles):

 
ISSUETO, MIR5P, INDEXPTS, STATUS, TOTALCREDIT
ABC CO, yes,  100,  closed,  234.90;
ABC CO, yes,  10,  closed,   45.00;
ABC CO,  ,   ,     open,  67.00;
ABC CO, no,   ,    open,  0.00 

In a separate table I want to know, specific to each query:
Number of rows returned (issueto), how many "yes" values were returned(mir5p), sum of index points(indexpts), how many "open" values were returned(status), and sum of charges(totalcredit) I got the sum of charges to work by: if not isnull(rs("totalcredit")) then total cost=totalcost + cdbl(rs("totalcredit")) and then the asp in the report table has <%=formatcurrency(totalcost)%> to display the results.


>
EXPERT RESPONSE
You may have to use the GROUP by function in your SQL statement. I set up a table called SHELLYS_TABLE (sorry I spelled your name wrong) and inserted data in the table as follows.

If you want an output that will be something like the following for the company ABC CO

SELECT issueto, MIR5P, status, SUM(indexpts), SUM(TOTALCREDIT) FROM SHELLYS_TABLE WHERE ISSUETO='ABC CO' GROUP BY ISSUETO, MIR5P, STATUS order by DECODE(MIR5P, NULL, '999999', MIR5P) DESC , STATUS DESC / If you want the counts of certain columns, say MIR5P and status then, you can use count function on these columns. For the second example I ran the query for the entire table, the query and its output is provided below:

SELECT issueto, MIR5P, status, count(MIR5P) CNT_M, count(status) CNT_S, SUM(indexpts) SUM_IDP, SUM(TOTALCREDIT), SUM_TC FROM SHELLYS_TABLE GROUP BY ISSUETO, MIR5P, STATUS order by ISSUETO, DECODE(MIR5P, NULL, '999999', MIR5P) DESC , STATUS DESC /

SELECT issueto, MIR5P, status, count(MIR5P), count(status), SUM(indexpts), SUM(TOTALCREDIT) FROM SHELLYS_TABLE WHERE ISSUETO='123 CO' GROUP BY ISSUETO, MIR5P, STATUS order by DECODE(MIR5P, NULL, '999999', MIR5P) DESC , STATUS DESC /


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


RELATED CONTENT
(Archive) SQL and PL/SQL
ORA-01654 even though maxextents defined as unlimited
Read, process and write a text file to the database
Concatenating a null character affecting performance
Generating a 10 character alphanumeric sequence
Line placement in an EMESSAGE
Specifying a column as NULL
Write a SQL script with optional arguments
Searching for stored reservation dates in a database
Error message while trying to write a Pl/SQL block
Why do many DBMS push their own programming languages?

Oracle PL/SQL
Oracle's free SQL Developer adds database migration tool
Confused about Oracle certification exams
ORA-01422 error when procedure returns more than one row
Calling procedure inside another procedure in anonymous block
How to import comma-delimited text file to Oracle table
Oracle updates Microsoft developer tools
PLS-00103 errors
PL/SQL do's and don't's: Five questions with Steven Feuerstein
Definition of force view
ORA-04082: NEW or OLD references not allowed in table level triggers

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
PL/SQL  (SearchOracle.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary



Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice

HomeNewsTopicsTipsAsk the ExpertsMultimediaWhite PapersProductsBlogs
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




All Rights Reserved, Copyright 2003 - 2008, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts