Terry Terry - 4 months ago 7
SQL Question

SQL command for TSM archives

Trying to run a select command that will show all my archives from a certain date. I can do this but the output has many entries for each archive as the date changes by the second. I only want archives by date format and not time format. Distinct does not work either. Here is my command

select DISTINCT NODE_NAME, DESCRIPTION, ARCHIVE_DATE from ARCHIVES where ARCHIVE_DATE >= '2016-05-19' order by ARCHIVE_DATE

Answer

Strip time from your ARCHIVE_DATE. See how to remove time from datetime for your database specifics. Eg. in Oracle you would write:

select DISTINCT NODE_NAME, DESCRIPTION, TRUNC(ARCHIVE_DATE)
from ARCHIVES
where ARCHIVE_DATE >= '2016-05-19'
order by TRUNC(ARCHIVE_DATE)
Comments