Previous Next

Thread: hide columns in output

Last post 09-08-2008 9:22 AM by jellis_ms. 1 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (2 items)

Sort Posts:

  • 07-24-2008, 2:45 PM

    hide columns in output

    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
     

  • 09-08-2008, 9:22 AM In reply to

    • jellis_ms
    • Not Ranked
    • Joined on 09-08-2008, 12:54 PM
    • Posts 7

    Re: hide columns in output

    Jason, I don't believe you need it in the select statement. have you tried putting it in the order by without putting it in the select stement like this?

     

    ORDER BY TO_DATE(TO_TIMESTAMP(Date, 'dd/MMM/yyyy')) AS DateTimeStamp, TimeStamp, User

     

    Mike

    Tags:
Page 1 of 1 (2 items)
Page view counter