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

Home Posts Topics Members FAQ

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

1 New Member
my problem is I have used invoice table, patient table.In Invoice table date,cash,credi t, 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.DOC DATE,'DD/MM/YYYY') DATES,
SUM(DECODE(INV. INVOICETYPECODE ,'CASH',INV.PAT IENTAMOUNT,'00. 00'))CASH,
SUM(DECODE(INV. INVOICETYPECODE ,'CRDT',INV.PAT IENTAMOUNT,'00. 00')) CREDIT,
SUM(DECODE(INV. INVOICETYPECODE ,'CHEQUE',INV.P ATIENTAMOUNT,'0 0.00')) CHEQUE,
SUM(NVL(INV.TOT ALDEPOSITAMOUNT ,0)) ADVANCE,
SUM(DECODE(INV. INVOICETYPECODE ,'CASH',INV.PAT IENTAMOUNT,'00. 00'))+
SUM(DECODE(INV. INVOICETYPECODE ,'CRDT',INV.PAT IENTAMOUNT,'00. 00'))+ SUM(DECODE(INV. INVOICETYPECODE ,'CC',INV.PATIE NTAMOUNT,'00.00 '))- SUM(NVL(INV.TOT ALDEPOSITAMOUNT ,0))TOTAL,
DECODE(PAT.REGI STRATIONTYPECOD E,'GEN',COUNT(P AT.REGISTRATION TYPECODE),'0')G ENREG,
DECODE(PAT.REGI STRATIONTYPECOD E,'EXT',COUNT(P AT.REGISTRATION TYPECODE),'0')E XTREG,
DECODE(PAT.REGI STRATIONTYPECOD E,'AE',COUNT(PA T.REGISTRATIONT YPECODE),'0')AE REG
/*COUNT(PAK.PACK AGETYPECODE)HEA LTHPKG,
DECODE(SPT.SPON SORTYPECODE,'CO RP',COUNT(SPT.S PONSORTYPENAME) ,'0')CORPORATE*/
FROM INVOICES INV,PATIENTS PAT/*, /*P*\ACKAGES PAK,SPONSORTYPE S SPT,INVOICEDETA ILS IND *\*\*/
WHERE INV.DOCIDPATIEN TS = PAT.DOCID
/*AND INV.DOCID = IND.DOCIDINVOIC ES(+)
AND IND.PACKAGECODE = PAK.PACKAGECODE
AND INV.SPONSORTYPE CODE = SPT.SPONSORTYPE CODE(+)
AND PAK.VISITTYPECO DE ='OUT'*\*/
GROUP BY TO_CHAR(INV.DOC DATE,'DD/MM/YYYY'),PAT.REGI STRATIONTYPECOD E/*,SPT.SPONSORTY PECODE*/
Jun 29 '07 #1
1 2764
debasisdas
8,127 Recognized Expert Expert
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
7111
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 name/password) in the session. Well, to never authenticate a user from information you got from the session. Each secure app on a site must challenge the user for name and password, each and every time the user accesses it (not just once and then store it in the session). If a secure app is multi-page,...
10
111269
by: N | last post by:
What is the function in SQL that works like DECODE in Oracle?" Thanks, N
4
4899
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' textarea? (cross browser compatable) Any help is appreciated. Regards.
0
3492
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 statements. Please send me the solutions . Then basic problem is the CASE has NOT condition i.e. <> ...... and this particularly i'm not able to convert in DECODE. Please send me the solution as early as possible.. I'm stuck up !!! I'm giving below the CASE statements and the DECODE...
1
1717
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 mechanicy f.g. mayby somebody have some script in .net who generate this schema. for any help Thanks ======== My xml file ================================= <ROOT> <Customers> <CustomerId>5555</CustomerId>
3
1290
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 it ok?
2
3416
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 http://www.paul.sladen.org/toys/samsung-yh-925/yh-925-db-0.1.py script, the idea behind the script is described at http://www.paul.sladen.org/toys/samsung-yh-925/ I'm getting errors and hoping someone could give me some hints, for I have no python background.
1
5770
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 suggestions. tk 2 Want keyboard answer input, for example: answer_str = raw_input(' Enter answer ') Herr Üü
6
3007
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(): self.cbAnalysisLibVersion(END, item) where __libVerDict is a dictionary that holds values as strings or
0
8363
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8883
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
8787
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
8561
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
8645
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...
1
6203
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
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...
1
2776
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.