ADSM-L

Re: SQL STATEMENT TO RELATE TABLES

2001-07-26 00:11:08
Subject: Re: SQL STATEMENT TO RELATE TABLES
From: Scotty Logan <swl AT STANFORD DOT EDU>
Date: Wed, 25 Jul 2001 21:11:52 -0700
On 25 July 2001, Gerardo Zapata wrote:
> The objective is to determine the name of a volume containing a specific
> archive from a specifice node.
>
> I use the following SQL to get the data:
>
> select volume_name,node_name,type from contents where node_name='MYNODE' and
> type='Arch'
>
> select node_name,archive_date,description from archives where
> node_name='MYNODE' and description='Archive Date: 07/25/2001'
>
> The common field for both tables is 'NODE_NAME', how could i combine
> these two statements to get the node name, archive description,
> archive date and volume name using a single sql command.

This worked for me:

SELECT DISTINCT contents.node_name,contents.volume_name, -
                archives.archive_date, archives.description -
  FROM contents,archives -
 WHERE contents.node_name = 'THUNDERBIRD -
   AND contents.type = 'Arch' -
   AND contents.node_name = archives.node_name -
   AND archives.description = 'Archive Date: 07/25/01'

  Scotty

--
Scotty Logan | ITSS | Stanford University | swl AT stanford DOT edu
Scotty Logan | ITSS | Stanford University | swl AT stanford DOT edu
<Prev in Thread] Current Thread [Next in Thread>