- 
                Notifications
    You must be signed in to change notification settings 
- Fork 689
How to unique by multiple properties
        agershun edited this page Dec 28, 2014 
        ·
        1 revision
      
    Source: StackOverflow.com
There is an array of objects with duplicates and I'm trying to get a unique listing, where uniqueness is defined by a subset of the properties of the object. For example,
    {a:"1",b:"1",c:"2"}And I want to ignore c in the uniqueness comparison.
    var data = [{a:"1",b:"1",c:"2"},{a:"1",b:"1",c:"1"}];
    var res = alasql('SELECT a,b FROM ? GROUP BY a,b',[data]);Try this example at jsFiddle
© 2014-2024, Andrey Gershun & Mathias Rangel Wulff
Please help improve the documentation by opening a PR on the wiki repo