ADSM-L

Re: [ADSM-L] SQL statement

2013-12-19 11:56:31
Subject: Re: [ADSM-L] SQL statement
From: apaschal5 AT frontier DOT com <apaschal5 AT FRONTIER DOT COM>
To: ADSM-L AT VM.MARIST DOT EDU
Date: Thu, 19 Dec 2013 08:54:31 -0800
Hi, Eric. You need to define how to join the tables.  In this case, a "where" 
condition like...

nodes.nodename = backups.nodename

Without that, you'll end up with a join table that has every combination of the 
rows of both tables.

Sent from my phone, so please excuse typos.


----- Reply message -----
From: "Loon, EJ van - SPLXM" <Eric-van.Loon AT KLM DOT COM>
To: <ADSM-L AT VM.MARIST DOT EDU>
Subject: [ADSM-L] SQL statement
Date: Thu, Dec 19, 2013 06:21


Hi guys!

I'm trying to make an SQL statement which uses the Nodes table and the
Backups table. It should do a count (*) from backups for files older
than 30 days but only when the Contact field starts with 'Airpas". Here
is what I got so far:



select nodes.node_name as "Nodename",count(*) as "Amount of backup files
older than 30 days" from nodes, backups where ((days(nodes.current_date)
- days(nodes.backup_date) >= 30)) and nodes.contact like 'Airpas%' and
backups.state='ACTIVE_VERSION' group by nodes.node_name



It's not correct and it probably has to do with the count(*) part,
because I don't know how you can specify that the count(*) is related to
the backups table.

Can somebody help me here please?

Thanks you very much in advance!

Kind regards,

Eric van Loon

AF/KLM Storage Engineering



********************************************************
For information, services and offers, please visit our web site: 
http://www..klm.com. This e-mail and any attachment may contain confidential 
and privileged material intended for the addressee only. If you are not the 
addressee, you are notified that no part of the e-mail or any attachment may be 
disclosed, copied or distributed, and that any other action related to this 
e-mail or attachment is strictly prohibited, and may be unlawful. If you have 
received this e-mail by error, please notify the sender immediately by return 
e-mail, and delete this message.

Koninklijke Luchtvaart Maatschappij NV (KLM), its subsidiaries and/or its 
employees shall not be liable for the incorrect or incomplete transmission of 
this e-mail or any attachments, nor responsible for any delay in receipt.
Koninklijke Luchtvaart Maatschappij N.V. (also known as KLM Royal Dutch 
Airlines) is registered in Amstelveen, The Netherlands, with registered number 
33014286
********************************************************
<Prev in Thread] Current Thread [Next in Thread>