« Previous Next »

Thread: Problem with graphing statement

Last post 10-22-2007 10:19 PM by Zhao Ji Ma - MSFT. 2 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (3 items)

Sort Posts:

  • 10-17-2007, 2:22 AM

    • vji6697
    • Not Ranked
    • Joined on 10-17-2007, 6:13 AM
    • Posts 2

    Problem with graphing statement

    Hi, Im new to logparser and my SQL is gained by reading the logparser help file, so please go easy :) I have a huge CSV file that I have managed to split into unique CSVs using a SELECT DISTICT statement, however I am having great trouble trying to graph the output. The source file looks like this (the real file is over 1000000 lines long) Application,Time,Alert Fred,15/10/2007 12:00,234 Fred,15/10/2007 13:00,42 Fred,15/10/2007 14:00,4354 Fred,15/10/2007 15:00,3453 Fred,15/10/2007 16:00,654 Fred,15/10/2007 17:00,756 Dave,15/10/2007 13:00,234 Dave,15/10/2007 14:00,764 Dave,15/10/2007 15:00,876 Dave,15/10/2007 16:00,353 Dave,15/10/2007 17:00,645 I use the statement... logparser "SELECT DISTINCT Application, * INTO *.csv FROM test.txt"" -i:CSV -o:CSV This will give me a separate csv for Fred and for Dave. I now want to plot, via a scattergraph the Alerts over Time for each Application. This is where I am getting stuck. I tried... logparser "SELECT DISTINCT Application, * INTO *.csv FROM test.txt group by time order by alert" -i:CSV -o:Chart -chartType:ScatterMarkers but i got Error: Semantic Error: SELECT clause field-expression "Application" is not an aggregate function and does not contain GROUP BY field-expressions Im a bit stuck as I cant understand what the error is telling me so am now stuck. Any help ?

  • 10-17-2007, 2:34 AM In reply to

    • vji6697
    • Not Ranked
    • Joined on 10-17-2007, 6:13 AM
    • Posts 2

    Re: Problem with graphing statement

    Sorry about the original post, I tried to re-edit but couldnt save the changes. Hope this is clearer

    Hi,

    Im new to logparser and my SQL is gained by reading the logparser help file, so please go easy :)

    I have a huge CSV file that I have managed to split into unique CSVs using a SELECT DISTICT statement, however I am having great trouble trying to graph the output.

    The source file looks like this (the real file is over 1000000 lines long)

    Application,Time,Alert

    Fred,15/10/2007 12:00,234

    Fred,15/10/2007 13:00,42

    Fred,15/10/2007 14:00,4354

    Fred,15/10/2007 15:00,3453

    Fred,15/10/2007 16:00,654

    Fred,15/10/2007 17:00,756

    Dave,15/10/2007 13:00,234

    Dave,15/10/2007 14:00,764

    Dave,15/10/2007 15:00,876

    Dave,15/10/2007 16:00,353

    Dave,15/10/2007 17:00,645>

    I use the statement...

    logparser "SELECT DISTINCT Application, * INTO *.csv FROM test.txt"" -i:CSV -o:CSV

    This will give me a separate csv for Fred and for Dave. I now want to plot, via a scattergraph the Alerts over Time for each Application.

    This is where I am getting stuck.

    I tried...

    logparser "SELECT DISTINCT Application, * INTO *.csv FROM test.txt group by time order by alert" -i:CSV -o:Chart -chartType:ScatterMarkers

    but i got

    Error: Semantic Error: SELECT clause field-expression "Application" is not an aggregate function and does not contain GROUP BY field-expressions

    Im a bit stuck as I cant understand what the error is telling me so am now stuck.

    Any help ?

  • 10-22-2007, 10:19 PM In reply to

    Re: Problem with graphing statement

    Hi,

    Per my understanding, this is because of the mixed use DISTINCT and GROUP BY. According to this:

    http://www.sqlteam.com/article/how-to-use-group-by-with-distinct-aggregates-and-derived-tables

    You probably need to use COUNT(Distinct) in GROUP BY queries. For more information about how to use GROUP BY and DISTINCT, please see this documentation.

    Hope it helps.

    Zhao Ji Ma
    Sincerely,
    Microsoft Online Community Support

    “Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. ”
Page 1 of 1 (3 items)
Microsoft Communities