I tried naming the column, but that didn't seem to work.
Using the column number as you and Paul suggested worked fine.
Thanks for the help!


-----Original Message-----
From: Prather, Wanda [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 19, 2002 10:32 AM
To: [EMAIL PROTECTED]
Subject: Re: Select statements


It's an SQL thing.

SQL operations occur in a certain order.
When you do a SELECT to query a table, the results you get back are actually
another (temporary) table.

"where" clauses are applied to columns in the original table
"order" clauses are applied to the columns in the result table

Backup_start isn't in your "results" table, because you didn't ask for that.
Date(backup_start) is a function, not a column name, so that doesn't work,
either.

Naming the column will fix it:

select date(backup_start) as GUMP , node_name , filespace_name from
filespaces where backup_start<=current_timestamp - 110 days order by GUMP


(There is probably a better written explantion for this somewhere, but my
solution for dealing with these SQL issues was to marry a DBA :>)

************************************************************************
Wanda Prather
The Johns Hopkins Applied Physics Lab
443-778-8769
[EMAIL PROTECTED]

"Intelligence has much less practical application than you'd think" -
Scott Adams/Dilbert
************************************************************************






-----Original Message-----
From: Jolliff, Dale [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 19, 2002 8:33 AM
To: [EMAIL PROTECTED]
Subject: Select statements


Is this really working as designed?

order by date(backup_start) doesn't work either.

This is TSM 4.2.2.4 on AIX

select date(backup_start), node_name, filespace_name from filespaces -
where backup_start<=timestamp(current_date - 110 days ) -
order by backup_start
ANR2964E The reference 'BACKUP_START' is not a column of the SQL result
table.

                                                            |
         ...................................................V...........
         tart<=timestamp(current_date - 110 days ) order by backup_start

ANS8001I Return code 3.

Reply via email to