ADSM-L

Re: Select odd behaviour

2002-05-01 11:57:40
Subject: Re: Select odd behaviour
From: Zlatko Krastev <acit AT ATTGLOBAL DOT NET>
Date: Wed, 1 May 2002 18:07:07 +0300
Direct answer - it's you. Details below:
1. use double quotes in AS statement -  "Unavailable" instead of
'Unavailable'
2. use AS outside the brackets - (select ...) AS "Read-only", (select ...)
AS "Unavailable".
Example:
select db.pct_utilized,log.pct_utilized,(select count(*) as "READONLY"
from volumes where access='READONLY'),(select count(*) from volumes where
access='UNAVAILABLE') as "Unavailable" from db,log
Result:
PCT_UTILIZED     PCT_UTILIZED      Unnamed[3]     Unavailable
------------     ------------     -----------     -----------
Explanation:
Explanation:
You are getting columns named in subquery, later included in the main
query as Unnamed[3] and Unnamed[4]. In the example one is modified and
results get correctly titled

Zlatko Krastev
IT Consultant




Please respond to "ADSM: Dist Stor Manager" <ADSM-L AT VM.MARIST DOT EDU>
Sent by:        "ADSM: Dist Stor Manager" <ADSM-L AT VM.MARIST DOT EDU>
To:     ADSM-L AT VM.MARIST DOT EDU
cc:

Subject:        Select odd behaviour

(Apologies. Re-Send with correct subject line)

In addition to what I said below, the following statement generates a
return
code 3 from TSM;

select db.pct_utilized,log.pct_utilized,(select count(*) from volumes
where
access='READONLY'),(select count(*) from volumes where
access='UNAVAILABLE'),(select count(*) from volumes where
access='UNAVAILABLE') from db,log



but If I change the end very slightly to

select db.pct_utilized,log.pct_utilized,(select count(*) from volumes
where
access='READONLY'),(select count(*) from volumes where
access='UNAVAILABLE'),(select count(*) from volumes) from db,log



(removing the :  "where access='UNAVAILABLE'")

It works fine!

Is it me, or TSM?

Thanks,

Matt.


<Prev in Thread] Current Thread [Next in Thread>