ADSM-L

Strange behavior of ORDER BY clause when used with SELECT DISTINCT (FYI)

2002-05-12 17:45:24
Subject: Strange behavior of ORDER BY clause when used with SELECT DISTINCT (FYI)
From: Zlatko Krastev <acit AT ATTGLOBAL DOT NET>
Date: Mon, 13 May 2002 00:42:36 +0300
Hello fellows,

I've just found a curious thing - running same select with and without
ORDER BY clause returns different number of rows. It looks like DISTINCT
clause forced somehow select statement to return only the first row for
each set of values in ORDER BY:
select domain_name,set_name,class_name from bu_copygroups order by
class_name
works fine - just as it ought to.

However the result of the same with DISTINCT is not so good:
select distinct domain_name,set_name,class_name from bu_copygroups order
by class_name

If the ORDER BY clause contains all the fields it returns good results:
select distinct domain_name,set_name,class_name from bu_copygroups -
order by class_name,domain_name,set_name

Again good results if we omit ORDER BY clause:
select distinct domain_name,set_name,class_name from bu_copygroups

Environment:
TSM server 4.1.4.1 on AIX 4.3.3ML6 or TSM server 4.2.1.15 on W2k SP2
TSM client 4.1.3.0 on AIX or 4.2.1.32 on W2k

PMR opened with IBM/Tivoli. Can someone try it on ISM v5.1?


Zlatko Krastev
IT Consultant
<Prev in Thread] Current Thread [Next in Thread>
  • Strange behavior of ORDER BY clause when used with SELECT DISTINCT (FYI), Zlatko Krastev <=