Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Postgresql Query Help

  • 11-03-2012 04:39AM
    #1
    Registered Users, Registered Users 2 Posts: 2,900 ✭✭✭


    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, Registered Users 2 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