473,425 Members | 1,829 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

I want to display record in this format PATIENT_CODE,gender,Malecount,femalecount

I want to display record in this format:
PATIENT_CODE,gender,Malecount,femalecount
Expand|Select|Wrap|Line Numbers
  1. Select PATIENT_CODE,gender,count(*)
  2. From BABY_MASTER Where Patient_Code='KBB-04-2010-96'
  3. group by PATIENT_CODE,SEX
This query shows Patient_code,gender,count, if there is 4 record for particular patient.

I want to display record in one row that should be in this format:
Patient_code,Malecount,femalecount
Can anybody help me with the solution?

Thanks in advance.
Nov 24 '10 #1
2 1513
ck9663
2,878 Expert 2GB
What's the name of the column for gender? Is it Gender or Sex? You have gender in the select list but Sex in Group By.

~~ CK
Nov 24 '10 #2
select PATIENT_CODE,sum(Fcount) as Fcount,sum(Mcount) as Mcount from
(
Select PATIENT_CODE,case gender when 'F' then 1 else 0 end as Fcount,case gender when 'M' then 1 else 0 end as Mcount
From BABY_MASTER Where Patient_Code='KBB-04-2010-96'
) cur group by PATIENT_CODE
Nov 25 '10 #3

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

Similar topics

3
by: Michael Charney | last post by:
I have a form where records are entered. I have turned off the built in record control. I created buttons to advance and go back through the records as well as an add new record button, but I also...
0
by: Amos Soma | last post by:
Hello. Our company has created a .Net application which the user starts by executing via a URL (i.e., http://someserver/application.exe). On some machines running Windows XP SP2, the user will...
4
by: fniles | last post by:
I have an ActiveX control in my web page that I tried to access using intranet. I have implemented IObjectSafety in the ActiveX control, and when I created the CAB file using VB Pakage and...
1
by: Lee810 | last post by:
The xml doc has pictures but in the format of a very long character string. I'm not sure what this format is called so I do not know what type of converter I should be looking for. May have...
4
by: mahadevk | last post by:
hi, friends pl help me, how to display record count in a report for a grouped records
10
by: maxx429 | last post by:
Good day all, Using Access 2007 but DB is created in Access 200o format so I can still use User Level security. I have what am sure is a very newbie question. I want to add a control to a form...
4
by: beemomo | last post by:
Hi everyone, i have a database with the information like: id transId transType 1001 3001 1 1002 3002 1 1003 3002 0 1004 3005 ...
0
by: zeroucla | last post by:
I need to connect a customized camera device (which outputs NTSC/PAL video format) to a mobile device and use it to display and record the video. However, I don't know how to interface the NTSC/PAL...
7
by: neovantage | last post by:
Hey all, I am creating a xml file in this format <?xml version="1.0" encoding="utf-8" standalone="yes"?> <customers> <customer> <category>Brosch&uuml;ren</category> ...
2
by: sweetjos | last post by:
I am retiriveing some names from on database by some conditions....that names are being displayed in the listbox..........my question is if i select a name that person details should be displayed in...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...
1
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...
0
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...
0
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,...
0
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...
0
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...
0
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...

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.