472,334 Members | 1,533 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,334 software developers and data experts.

check decode fuction for ae,ext,gen and check joining

1
my problem is I have used invoice table, patient table.In Invoice table date,cash,credit, cheque,advance,total is coming.but in patient table having registration type code having gen registraion means gen, external reg means ext,acccident & emergency reg means AE.hear patient,invoice table have date column.but I have to display invoice date. that date no of gen reg, ext reg,ae reg not coming when joining two tables.gen reg, ext reg, AE reg i have used decode fuction. is it correct or not check it.




SELECT TO_CHAR(INV.DOCDATE,'DD/MM/YYYY') DATES,
SUM(DECODE(INV.INVOICETYPECODE,'CASH',INV.PATIENTA MOUNT,'00.00'))CASH,
SUM(DECODE(INV.INVOICETYPECODE,'CRDT',INV.PATIENTA MOUNT,'00.00')) CREDIT,
SUM(DECODE(INV.INVOICETYPECODE,'CHEQUE',INV.PATIEN TAMOUNT,'00.00')) CHEQUE,
SUM(NVL(INV.TOTALDEPOSITAMOUNT,0)) ADVANCE,
SUM(DECODE(INV.INVOICETYPECODE,'CASH',INV.PATIENTA MOUNT,'00.00'))+
SUM(DECODE(INV.INVOICETYPECODE,'CRDT',INV.PATIENTA MOUNT,'00.00'))+ SUM(DECODE(INV.INVOICETYPECODE,'CC',INV.PATIENTAMO UNT,'00.00'))- SUM(NVL(INV.TOTALDEPOSITAMOUNT,0))TOTAL,
DECODE(PAT.REGISTRATIONTYPECODE,'GEN',COUNT(PAT.RE GISTRATIONTYPECODE),'0')GENREG,
DECODE(PAT.REGISTRATIONTYPECODE,'EXT',COUNT(PAT.RE GISTRATIONTYPECODE),'0')EXTREG,
DECODE(PAT.REGISTRATIONTYPECODE,'AE',COUNT(PAT.REG ISTRATIONTYPECODE),'0')AEREG
/*COUNT(PAK.PACKAGETYPECODE)HEALTHPKG,
DECODE(SPT.SPONSORTYPECODE,'CORP',COUNT(SPT.SPONSO RTYPENAME),'0')CORPORATE*/
FROM INVOICES INV,PATIENTS PAT/*, /*P*\ACKAGES PAK,SPONSORTYPES SPT,INVOICEDETAILS IND *\*\*/
WHERE INV.DOCIDPATIENTS = PAT.DOCID
/*AND INV.DOCID = IND.DOCIDINVOICES(+)
AND IND.PACKAGECODE = PAK.PACKAGECODE
AND INV.SPONSORTYPECODE = SPT.SPONSORTYPECODE(+)
AND PAK.VISITTYPECODE ='OUT'*\*/
GROUP BY TO_CHAR(INV.DOCDATE,'DD/MM/YYYY'),PAT.REGISTRATIONTYPECODE/*,SPT.SPONSORTYPECODE*/
Jun 29 '07 #1
1 2699
debasisdas
8,127 Expert 4TB
Since i dont have the table it is very difficult to check the code over here.

Can you please post what is the error message you are getting.
Jun 29 '07 #2

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

Similar topics

27
by: mrbog | last post by:
Tell me if my assertion is wrong here: The only way to prevent session hijacking is to NEVER store authentication information (such as...
10
by: N | last post by:
What is the function in SQL that works like DECODE in Oracle?" Thanks, N
4
by: Newbie | last post by:
How would I modify this form to encode *all* the characters in the 'source' textarea to the '%xx' format & place result code into the 'output'...
0
by: richasaraf | last post by:
Hello everyone, Please HELP !!!!! I'm facing problem in converting CASE statements into DECODE. As i have PL/SQL 8i, so it does not handle CASE...
1
by: Szaki | last post by:
I use a BulkLoad to import file.xml to my base MS Server 2000. To import this xml file I need schema file. Mayby you know how to do this file...
3
by: mike | last post by:
i've already used static fuction to make website i wanna common module that's why i used static fuctions. may be it's more than 100 fuction ...is...
2
by: rsd | last post by:
Hi, I'm trying get Samsung YH-920 mp3 player to work with Debian GNU/Linux. To do that I need to run...
1
by: anonymous | last post by:
1 Objective to write little programs to help me learn German. See code after numbered comments. //Thanks in advance for any direction or...
6
by: dudeja.rajat | last post by:
Hi, How to check if something is a list or a dictionary or just a string? Eg: for item in self.__libVerDict.itervalues():...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...

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.