« Previous Next »

Thread: Select, Group by and Order by clause

Last post 04-13-2009 3:31 PM by ksingla. 1 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (2 items)

Sort Posts:

  • 04-10-2009, 1:24 PM

    Select, Group by and Order by clause

    Curious if anyone would know the the correct syntax for the below statement to show all event id's. The way I've written it below it only shows 540 (logon's), is there way for me to use the below code to show ALL event ID's?

    "select date,time,evtid,status,username,ip from \\myserver\logs\logfile.csv where ip is not null order by date, time, evtid, status, username, ip asc

     if I use the "select *  statement i'm unable to use the "group by" or "order by" clause because they do not match what is in the "select" clause.  Is there a way around this?

  • 04-13-2009, 3:31 PM In reply to

    • ksingla
    • Top 25 Contributor
    • Joined on 06-14-2006, 3:02 AM
    • Redmond, WA
    • Posts 863

    Re: Select, Group by and Order by clause

    I don't see any filter on eventId. Are you sure eventIds other than 540 have IP as null? Can you paste some data from your CSV showing different eventId entries?

    You should be able to use order by with "select *". You need to aggregate the column when using group by and that is why "select *" with group by is usually not possible.

    Thanks,
    Kanwal

    Follow me on twitter at http://twitter.com/kjsingla
Page 1 of 1 (2 items)
Microsoft Communities