I need to write a query that reads in a CSV file, does some magic, and then write an output CSV file.
Specifically, I am merging two Blue Coat proxy server usage reports, removing duplicates, and cutting up some strings.
Afterwards, I use a perl script to convert it to an Excel spreadsheet.
My problem is that I need to sort by two derived values I don't want displayed in the output CSV.
How can I create a SELECT statement that does the work and an ORDER BY statement that sorts with the values, but have the values not show up in the CSV.
The sql looks like this:
SELECT DISTINCT
User,
TO_DATE(TO_TIMESTAMP(Date, 'dd/MMM/yyyy')) AS DateTimeStamp,
TO_TIME(TO_TIMESTAMP(Time, 'HH:mm:ss')) AS TimeTimeStamp,
TO_STRING(DateTimeStamp, 'M/d/yyyy') AS DateString,
TO_STRING(TimeTimeStamp, 'H:mm:ss tt') AS TimeString,
REPLACE_STR( EXTRACT_TOKEN( Url, 0, ':' ), 'tcp', 'tcp-ssl' ) AS Protocol,
EXTRACT_TOKEN( Url, 2, '/' ) AS Host,
COALESCE( INT_TO_IPV4( IPV4_TO_INT( EXTRACT_TOKEN( Url, 2, '/' ) ) ), EXTRACT_SUFFIX( Host, 1, '.' ) ) AS Domain,
STRCAT( '/', EXTRACT_SUFFIX( Url, -3, '/' ) ) AS Query,
Url AS [Full URL],
Category,
Verdict,
[Total Bytes],
Requests
INTO '%OutputFile%'
FROM %InputFile1%, %InputFile2%
ORDER BY DateTimeStamp,TimeTimeStamp,User
I don't want the DateTimeStamp and TimeTimeStamp to show up in the output.
Thanks, Jason