473,396 Members | 2,016 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,396 software developers and data experts.

query bailing out after one row returned?

uname -a
Linux XXXX 2.4.21-27.ELsmp #1 SMP Wed Dec 1 21:59:02 EST 2004 i686 i686
i386 GNU/Linux

db2level
DB21085I Instance "vhsinst" uses "32" bits and DB2 code release
"SQL08022"
with level identifier "03030106".
Informational tokens are "DB2 v8.1.0.89", "OD_14086", "MI00105_14086",
and
FixPak "9".
Product is installed at "/opt/IBM/db2/V8.1".
Greetings, I got a query that gives different results dependent of the
number of columns in the select part. I will report this to IBM, just
curious if anyone has a good explanation how this can happen

select a.* from nya.APPLICATION a
INNER JOIN nya.PERSON p
on a.person_id = p.person_id
INNER JOIN nya.INTERIM_PERSON ip
on a.person_id = ip.person_id
LEFT OUTER JOIN nya.PERSON_ADDRESS pa
on pa.person_id = a.person_id
and addresstype_id = '2'
WHERE a.admissionround_id = 'VT2006'
AND p.deceased = 0
[...]
745 record(s) selected.

but if I add pa.addresstype_id in the select clause, I only get one row

select a.*, pa.addresstype_id from nya.APPLICATION a
INNER JOIN nya.PERSON p
on a.person_id = p.person_id
INNER JOIN nya.INTERIM_PERSON ip
on a.person_id = ip.person_id
LEFT OUTER JOIN nya.PERSON_ADDRESS pa
on pa.person_id = a.person_id
and addresstype_id = '2'
WHERE a.admissionround_id = 'VT2006'
AND p.deceased = 0
[...]
1 record(s) selected.

Furthermore, if I move the deceased predicate to the join condition I
get the 745 rows again.

select a.*, pa.addresstype_id from nya.APPLICATION a
INNER JOIN nya.PERSON p
on a.person_id = p.person_id
AND p.deceased = 0
INNER JOIN nya.INTERIM_PERSON ip
on a.person_id = ip.person_id
LEFT OUTER JOIN nya.PERSON_ADDRESS pa
on pa.person_id = a.person_id
and addresstype_id = '2'
WHERE a.admissionround_id = 'VT2006'
[...]
745 record(s) selected.

Any ideas anyone? This is puzzling me, at first I thought that there
might be a corrupt index or something, but all look fine, and there is
no info in the db2diag.log
Kind regards
/Lennart

Nov 30 '05 #1
1 1393
le*****@kommunicera.umea.se wrote:
uname -a
Linux XXXX 2.4.21-27.ELsmp #1 SMP Wed Dec 1 21:59:02 EST 2004 i686 i686
i386 GNU/Linux

db2level
DB21085I Instance "vhsinst" uses "32" bits and DB2 code release
"SQL08022"
with level identifier "03030106".
Informational tokens are "DB2 v8.1.0.89", "OD_14086", "MI00105_14086",
and
FixPak "9".
Product is installed at "/opt/IBM/db2/V8.1".
Greetings, I got a query that gives different results dependent of the
number of columns in the select part. I will report this to IBM, just
curious if anyone has a good explanation how this can happen

select a.* from nya.APPLICATION a
INNER JOIN nya.PERSON p
on a.person_id = p.person_id
INNER JOIN nya.INTERIM_PERSON ip
on a.person_id = ip.person_id
LEFT OUTER JOIN nya.PERSON_ADDRESS pa
on pa.person_id = a.person_id
and addresstype_id = '2'
WHERE a.admissionround_id = 'VT2006'
AND p.deceased = 0
[...]
745 record(s) selected.

but if I add pa.addresstype_id in the select clause, I only get one row

select a.*, pa.addresstype_id from nya.APPLICATION a
INNER JOIN nya.PERSON p
on a.person_id = p.person_id
INNER JOIN nya.INTERIM_PERSON ip
on a.person_id = ip.person_id
LEFT OUTER JOIN nya.PERSON_ADDRESS pa
on pa.person_id = a.person_id
and addresstype_id = '2'
WHERE a.admissionround_id = 'VT2006'
AND p.deceased = 0
[...]
1 record(s) selected.

Furthermore, if I move the deceased predicate to the join condition I
get the 745 rows again.

select a.*, pa.addresstype_id from nya.APPLICATION a
INNER JOIN nya.PERSON p
on a.person_id = p.person_id
AND p.deceased = 0
INNER JOIN nya.INTERIM_PERSON ip
on a.person_id = ip.person_id
LEFT OUTER JOIN nya.PERSON_ADDRESS pa
on pa.person_id = a.person_id
and addresstype_id = '2'
WHERE a.admissionround_id = 'VT2006'
[...]
745 record(s) selected.

Any ideas anyone? This is puzzling me, at first I thought that there
might be a corrupt index or something, but all look fine, and there is
no info in the db2diag.log
Kind regards
/Lennart

Please open a PMR.

--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Nov 30 '05 #2

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

Similar topics

5
by: Jerome | last post by:
Hi, I've got the following problem: I want my ASP page to display a certain number (based on a COUNT query), it works fine if the result is at least 1! If there are no records to be counted...
5
by: Bernie | last post by:
Greetings, I have 3 servers all running SQL Server 2000 - 8.00.818. Lets call them parent, child1, and child 2. On parent, I create a view called item as follows: CREATE view Item as...
12
by: Joe Stanton | last post by:
Hello Group I have a query that works in Oracle and SQL Server, but fails in Microsoft Access. The query is: SELECT data fromTABLE1 WHERE data>='A&' AND data<'A''' Here is my sample data:
4
by: Chris Tremblay | last post by:
I am trying to figure out how to go about retrieving the number of results returned from my queries in SQL server from VB.NET without using a the Select Count(*) query. The method that I was using...
4
by: Jonesgj | last post by:
Hi, Whats the best way of capturing a null returned from a query? What through me last night was I knew the table I was querying was empty, so I thought the data reader HasRows method would be...
0
by: lennart | last post by:
uname -a Linux XXXX 2.4.21-27.ELsmp #1 SMP Wed Dec 1 21:59:02 EST 2004 i686 i686 i386 GNU/Linux db2level DB21085I Instance "vhsinst" uses "32" bits and DB2 code release "SQL08022" with level...
8
by: Roland Hall | last post by:
In Access you use "*" + + "*", + can be replaced with & Calling a parameterized query in Access requires % be used in place of *, however, all that I have read show dynamic SQL passed to Access: ...
3
by: Oenone | last post by:
I have a project that creates a SqlDataAdapter and uses its Fill method to fill a DataTable with data from a user-provided query. From there I can obviously access details about the rows and...
16
by: The Frog | last post by:
Hi Everyone, I have a small problem that doesnt seem to make any sense. I am using Access 97, and have a query that selects data from a text field, converts it to type Lng. This seems to work...
5
by: Vincent | last post by:
I have experienced something in Access that is completely inexplicable and gives me shivers. I was creating a query inside the query wizard that I knew should return several records. I ran the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...
0
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...
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,...

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.