Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Postgresql Query Help

Options
  • 11-03-2012 4:39am
    #1
    Registered Users Posts: 2,530 ✭✭✭


    Hi,

    I have a postgresql query which i have managed to get functional as follows:

    select subtype as event_type, count(*) as totalnum
    from $log
    where $filter
    and action='client-authentication'
    and MAC='60:fb:42:d8:60:7e'
    group by event_type

    This gives me a count based on
    action='client-authentication'
    and specific MAC='60:fb:42:d8:60:7e'

    However i will have multiple MAC addresses and duplicates.
    How can i adapt the above query to show me entries with the MAC field populated and exclude duplicates.

    Have limited knowledge of SQL queries these days!

    Thanks in advance.


Comments

  • Registered Users Posts: 2,781 ✭✭✭amen


    [PHP]
    select DISTINCT MAC,subtype as event_type, count(*) as totalnum
    from $log
    where $filter
    and action='client-authentication'
    group by MAC,event_type
    [/PHP]

    should do it for you but why would you want to exclude a duplicate MAC ?


Advertisement