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 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
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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,...
|
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...
|
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
|
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...
|
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...
|
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...
|
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 =...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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)...
|
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...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
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...
| |