473,666 Members | 2,461 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Oracle question.

5 New Member
Dear sir,

Iam Oracle developer(D2k), i have a problem in developing the query.....
let me explain in detail,

Report is Revenues for the year of Doctors.

i have develope the query, which give out but like:

Revenue type doctor name Amount
------------------------------------------------------------
consultation umesh k.m 5000

this for, total period.

but, i want to print, months wise,
like:
Revenue type doctor name jan feb mar april.......... ....... dec
--------------------------------------------------------------------------------------------------------

can u plz, help me out this problem.......

my query looks like:


Expand|Select|Wrap|Line Numbers
  1. SELECT 
  2. TO_CHAR(INVOICE_DATE,'MON') MONTH,
  3. TO_CHAR(INVOICE_DATE,'YYYY') YEAR, 
  4. REVENUE_TYPE_NAME, 
  5. DOCTOR_NAME, 
  6. SUM(AMOUNT) TOTALAMOUNT 
  7. FROM 
  8.        INVOICEMASTER IVM, 
  9.        INVOICEDETAILS IVD, 
  10.        DOCTORMASTER DTM, 
  11.        MASTERTABLE MRT, 
  12.        REVENUETYPEMASTER RTM, 
  13.        COSTCENTERMASTER CCM 
  14. WHERE 
  15.       IVM.INVOICE_NO=IVD.INVOICE_NO 
  16.       AND IVD.DOCTOR_CODE=DTM.DOCTOR_CODE 
  17.       AND IVD.SER_CODE=MRT.RECORD_CODE 
  18.       AND MRT.REVENUE_TYPE_CODE=RTM.REVENUE_TYPE_CODE 
  19.       AND MRT.COSTCENTER_CODE=CCM.COSTCENTER_CODE 
  20.           AND IVM. CANCELINVOICENO IS NULL 
  21.       AND IVD. AMOUNT > 0
  22. GROUP BY 
  23. TO_CHAR(INVOICE_DATE,'MON'),
  24. TO_CHAR(INVOICE_DATE,'YYYY'), 
  25. REVENUE_TYPE_NAME, 
  26. DOCTOR_NAME 
  27. ORDER BY 
  28. TO_CHAR(INVOICE_DATE,'MON'),
  29. TO_CHAR(INVOICE_DATE,'YYYY')
  30.  
plz help me out...

chandra....
Nov 15 '08 #1
13 1834
Stang02GT
1,208 Recognized Expert Top Contributor
This belongs in the Oracle forum and please make sure to use code tags when posting code. I will add them in for you this time.
Nov 16 '08 #2
chandra794
5 New Member
Hello,

i have built a query, which gives amount of doctor monthly wise, I want to sum and place beside it.

query output as:

revenuetype doctor jan feb mar apr ...........dec
--------------------------------------------------------------------------------------------------------
consultation chandu 235 300 205 500 169.

but i want as follows

revenuetype doctor jan feb mar apr ...........dec Total
-----------------------------------------------------------------------------------------------------------------
consultation chandu 235 300 205 500 169. sum

by using this query, i want to develop a report in Reports6i.

plz, can anyone help out....

chandra......
Nov 16 '08 #3
Pilgrim333
127 New Member
Hi,

What is the query you are using now?

Pilgrim.
Nov 16 '08 #4
amitpatel66
2,367 Recognized Expert Top Contributor
you just need to sum up all the columns that will give you total.

For Eg: (jan+feb+mar+ap r+.....) Total
Nov 17 '08 #5
amitpatel66
2,367 Recognized Expert Top Contributor
What is the output of your query?...Could you please post the error your query is giving or in case incorrect ouput of your query?
Nov 17 '08 #6
chandra794
5 New Member
hi amit,

thanks for ur, reply.....any how, i have resolved my problems by myself..
thank u for responding to my problems....

i have another problem,

Report format looks like:

Department:
Doctor name:
Revenue type:
Service Amount:
-----------------------------------

i have develop the query, but, i want to sum up each service and put the total in the amount column.

eg: per day if there are 5 new visits for a doctor, my query prints 5 times, but, i want to sum of this 5 new visits and print.
same as for Follow up.......etc...

my query:
Expand|Select|Wrap|Line Numbers
  1. SELECT 
  2. CM.COSTCENTER_NAME,
  3. DM.DOCTOR_NAME,
  4. RM.REVENUE_TYPE_NAME,
  5. ID.INVOICE_NO,
  6. ID.ITEM_DRG_SER_NAME,
  7. ID.AMOUNT
  8. FROM 
  9. COSTCENTERMASTER CM,
  10. DOCTORMASTER DM,
  11. MASTERTABLE MT,
  12. REVENUETYPEMASTER RM,
  13. INVOICEDETAILS ID
  14. WHERE 
  15. REQ_DATE BETWEEN :FROMDATE AND :TODATE AND
  16. CM.COSTCENTER_CODE=DM.DEPT_CODE AND
  17. MT.REVENUE_TYPE_CODE=RM.REVENUE_TYPE_CODE AND
  18. MT.RECORD_CODE=ID.SER_CODE AND
  19. MT.COSTCENTER_CODE=CM.COSTCENTER_CODE
  20. GROUP BY 
  21. COSTCENTER_NAME,
  22. DOCTOR_NAME,
  23. RM.REVENUE_TYPE_NAME,
  24. ID.INVOICE_NO,
  25. ID.ITEM_DRG_SER_NAME,
  26. ID.AMOUNT
  27. ORDER BY 
  28. CM.COSTCENTER_NAME,
  29. DM.DOCTOR_NAME,
  30. RM.REVENUE_TYPE_NAME,
  31. ID.INVOICE_NO
can u help me out...
chandra
Nov 17 '08 #7
Pilgrim333
127 New Member
Hi,

It would help if you would provide the solution that helped you with your first problem before posting another problem. The reason is, that other people who visit the forum can be helped by it.

Pilgrim.
Nov 17 '08 #8
amitpatel66
2,367 Recognized Expert Top Contributor
I did not understand your query that you have used. Why are you using a GROUP BY clause in your query?

Try the below query that would display list of visits and SUM(Amount) for visits on a particular day

Expand|Select|Wrap|Line Numbers
  1.  
  2. SELECT  
  3. CM.COSTCENTER_NAME, 
  4. DM.DOCTOR_NAME, 
  5. RM.REVENUE_TYPE_NAME, 
  6. ID.INVOICE_NO, 
  7. ID.ITEM_DRG_SER_NAME, 
  8. SUM(ID.AMOUNT) OVER(PARTITION BY TRUNC(REQ_DATE) ORDER BY TRUNC(REQ_DATE)) Total_Amount 
  9. FROM  
  10. COSTCENTERMASTER CM, 
  11. DOCTORMASTER DM, 
  12. MASTERTABLE MT, 
  13. REVENUETYPEMASTER RM, 
  14. INVOICEDETAILS ID 
  15. WHERE  
  16. REQ_DATE BETWEEN :FROMDATE AND :TODATE AND 
  17. CM.COSTCENTER_CODE=DM.DEPT_CODE AND 
  18. MT.REVENUE_TYPE_CODE=RM.REVENUE_TYPE_CODE AND 
  19. MT.RECORD_CODE=ID.SER_CODE AND 
  20. MT.COSTCENTER_CODE=CM.COSTCENTER_CODE 
  21. ORDER BY  
  22. CM.COSTCENTER_NAME, 
  23. DM.DOCTOR_NAME, 
  24. RM.REVENUE_TYPE_NAME, 
  25. ID.INVOICE_NO 
  26.  
  27.  
Nov 17 '08 #9
chandra794
5 New Member
HAI AMIT,

Thank u for your reply,
I have executed ur query, iam getting repetation of data.
let me explain clearly,

ITEM_DRG_SER_NA ME is the service, eg: newvist , reviews, followup,...etc .
i want to sum all the newvisits, followup and reviews seperatly by docor wise.....

for ex:
doctorname services amount
----------------------------------------------------------------------
chandra newvisit 50kd
chandra followup 150kd
chandra reviews 10kd
amit followup 200kd
umesh reviews 110kd....


i want in this way....
iam groping to avoid repeation of data....

thanks,
amit......
Nov 17 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

0
2070
by: Mark Townsend | last post by:
Following is a summary of articles spanning a 7 day period, beginning at 23 Feb 2004 05:29:19 GMT and ending at 01 Mar 2004 04:12:14 GMT. Notes ===== - A line in the body of a post is considered to be original if it does *not* match the regular expression /^\s{0,3}(?:>|:|\S+>|\+\+)/. - All text after the last cut line (/^-- $/) in the body is
1
12372
by: Gilles Cadorel | last post by:
Sur un PC, nous avons installé plusieurs version d'Oracle Client. Plusieurs logiciels tiers utilisant Oracle ne demandent pas lors de leur installation, quelle version d'Oracle utiliser. Ces logiciels fonctionnent correctement mais nous aimerions savoir à coup sûr, quel Client Oracle est réellement utilisé. Merci d'avance
38
25079
by: Mike | last post by:
No flame wars, please! We're planning a move from a non-relational system to a relational system. Our choices have been narrowed to Oracle and DB2. Since we're moving from non-relational to relational, then we're not currently using any relational-type operators. So I expect the end result to use simple, SQL standard commands and queries. The question: At the SQL standard level is there any
11
12697
by: Markus Breuer | last post by:
I have a question about oracle commit and transactions. Following scenario: Process A performs a single sql-INSERT into a table and commits the transaction. Then he informs process B (ipc) to read the new date. So process B starts "select ..." but does not get the previously inserted row. The timespan between commit and select is very short. (NOTE: two different sessions are used) Questions: 1.) Does commit when returning from call...
125
15416
by: Rhino | last post by:
One of my friends, Scott, is a consultant who doesn't currently have newsgroup access so I am asking these questions for him. I'll be telling him how to monitor the answers via Google Newsgroup searches. Scott has heard a lot of hype about DB2 and Oracle and is trying to understand the pros and cons of each product. I'm quite familiar with DB2 but have never used Oracle so I can't make any meaningful comparisons for him. He does not have...
7
4176
by: Murtix Van Basten | last post by:
Hi all, I will deploy a database project to an Oracle server, but I could not figure out which version of Oracle should I get. Here is my configuration: Hardware: Dell 1750 Dual Xeon 3.2Ghz, 2GB Ram, 3x36GB Hdd on Raid 5 Operating System: Redhat Linux 9 I will deploy only 1 database for the application. Only 1 DBA will use the Oracle server when necessary. When the database once deployed, Only 1
11
3183
by: Mark A | last post by:
Here is Mark Townsend's (Oracle Product Manager) explanation and justification for posting in the DB2 newsgroup, as posted on the Oracle newsgroup, and my response: "Mark Townsend" <markbtownsend@comcast.net> wrote in message > > By an large you will find that they > all fall into 1 of 3 categorires. > > 1) Explaining how Oracle does something when somebody asks how to do the
3
23452
by: Jon Ole Hedne | last post by:
My Access 2002-application need to work with tables from both Oracle and Access. To solve this, I want to run some querys on three views in Oracle and import the results into temporary Access-tables. I have tried this: conn.Provider = "Microsoft.Jet.OLEDB.4.0" conn.ConnectionString = "data source=" & datafil & ";Jet OLEDB:Database Password=" conn.Open datafil
6
2819
by: JV | last post by:
A ref cursor data type can obviously be returned as an output parameter of a stored procedure, but can an ASP.NET application call an oracle proc that uses a ref cursor as an input parameter? If so, how? What object do you pass as that parameter? We are using System.Data.OracleClient, but if necessary, we might be able to switch.
14
4586
by: jehugaleahsa | last post by:
Hello: I am working with Oracle .NET Stored Procedures. I would like to know how to return the results of a SELECT statement. I have tried returning a OracleRefCursor and a DataTable, but nothing seems to work. What data type must I return for this to be accepted as .NET stored procedure?
0
8878
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8785
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8560
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8644
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7389
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4200
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2012
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1778
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.