473,321 Members | 1,877 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,321 software developers and data experts.

selecting XML columns

Xh
Hi All,

I'm using DB2 v9 Express-C - I have problem when selecting XML
columns.

I have 2 columns in patients table:
- id_patient
- patient_info

select * from patients;
select id_patient, patient_info from patients;

work fine - but that's easy ;)

I added new table examinations (1 patient can have many examinations)
examination:
id_examination
id_patient
examination_results

and tried to do something like this, show me patients' ids and infos +
number of examinations:

SELECT P.ID_PATIENT, P.PATIENT_INFO, COUNT(E.ID_EXAMINATION) AS
EXAMINATION#
FROM PATEINTS as P, EXAMINATIONS as E
WHERE P.ID_PATIENT = E.ID_PATIENT
GROUP BY P.ID_PATIENT;

but above query returns an error - P.PATIENT_INFO is not included in
"group by", but when
I added it, there was another error saying that XML cannot be used in
grouping functions

any idea what should I do to fetch pateint_info XML + number of
examinations in one query?
does DB2 supports such things?

I have written query with subquery that produces me expected results
- but I'm wondering whether it can be done faster and in more
beautiful way ;)

thanks in advance for any tips
best regards
R

Feb 23 '07 #1
1 1794
XML columns cannot be added in group by clause.

Swami
--------------------------------------

On Feb 24, 3:37 am, "Xh" <lukasz.bud...@komputery-internet.netwrote:
Hi All,

I'm using DB2 v9 Express-C - I have problem when selecting XML
columns.

I have 2 columns in patients table:
- id_patient
- patient_info

select * from patients;
select id_patient, patient_info from patients;

work fine - but that's easy ;)

I added new table examinations (1 patient can have many examinations)
examination:
id_examination
id_patient
examination_results

and tried to do something like this, show me patients' ids and infos +
number of examinations:

SELECT P.ID_PATIENT, P.PATIENT_INFO, COUNT(E.ID_EXAMINATION) AS
EXAMINATION#
FROM PATEINTS as P, EXAMINATIONS as E
WHERE P.ID_PATIENT = E.ID_PATIENT
GROUP BY P.ID_PATIENT;

but above query returns an error - P.PATIENT_INFO is not included in
"group by", but when
I added it, there was another error saying that XML cannot be used in
grouping functions

any idea what should I do to fetch pateint_info XML + number of
examinations in one query?
does DB2 supports such things?

I have written query with subquery that produces me expected results
- but I'm wondering whether it can be done faster and in more
beautiful way ;)

thanks in advance for any tips
best regards
R

Feb 25 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Axial | last post by:
Question: How to select columns from Excel-generated XML when some cells are empty. I've found examples where rows are to be selected, but I can't seem to extrapolate from that to selecting...
2
by: Robert | last post by:
Hi All, I'm trying to solve this for a few days now and I just can't figure it out... I have three tables set up, I'll simplify them for this question: Table 1: HOTELS Columns: HOTEL_ID,...
6
by: aaj | last post by:
Hi all I use a data adapter to read numerous tables in to a dataset. The dataset holds tables which in turn holds full details of the records i.e. keys, extra colums etc.. In some cases I...
4
by: rodchar | last post by:
Hey all, Is there a way to get similar functionality as the SELECT DISTINCT records in a SQL Statement when selecting records from a dataset? thanks, rodchar
4
by: Tmuld | last post by:
Hello, I have a complete table within a dataset. I want a dataview to show particular filtered data - works great with the dv.rowfilter. But can I display only certain columns that are...
11
by: Ron L | last post by:
I have a data table that lists a series of items in my database. In my user form, I want the user to be able to filter by a number of criteria (e.g. location, contract, date modified, etc). Other...
2
by: Will Newton | last post by:
I have attached some SQL which produces what to me, at least, is rather unexpected results. Selecting real columns into double precision columns loses some precision. Is this expected or documented...
4
by: tshad | last post by:
I have a dataGrid that I filled with files from my directory. I am using VS 2003 and Windows Forms. ************************************************************ Dim dirInfo As DirectoryInfo =...
5
by: hollyquinn | last post by:
Hi I am working with a web application where I am selecting values from a SQL Server 2005 database and then loading the values into different controls on my page. Most of the values load with no...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.