Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6020457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:34:19+00:00 2026-05-23T03:34:19+00:00

I have a table which contains the following columns: UniqueID remote_ip_addr platform I want

  • 0

I have a table which contains the following columns:

UniqueID
remote_ip_addr
platform

I want to create a query, which basically shows each IP address just once from each platform and count how many distinct platform entries there are

SELECT platform, COUNT(platform) 
FROM fuckedapps_dm_appdl dm 
GROUP BY platform 
ORDER BY COUNT(platform) DESC

So for example from the following table:

uniqueID---remote_ip_addr----platform
1           20.15.1.234       iPhone
2           20.15.1.234       iPhone
3           20.15.1.234       iPhone
4           20.15.1.234       Android
5           20.15.1.234       Android

I’ll get the following result:

platform----COUNT(platform)
iPhone          1
Android         1

Right now I get the following:

platform----COUNT(platform)
iPhone          3
Android         2

Because they’re all the same ip, I want to get only 1 distinct value…

Thank you for your help.

edit: I should have mentioned that there’s another field, which is called app_id.

So the table is more like:

uniqueID---remote_ip_addr----platform---app_id
1           20.15.1.234       iPhone      23
2           20.15.1.234       iPhone      23
3           20.15.1.234       iPhone      18
4           20.15.1.234       Android     24
5           20.15.1.234       Android     25

in this case, I want the result to be:

platform----COUNT(platform)
iPhone          2
Android         2

Thank you, and sorry because I didn’t think it was relevant and now I see it is.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T03:34:19+00:00Added an answer on May 23, 2026 at 3:34 am

    If I understand correctly, you want for every platfrom, the number of distinct IP addresses. Then you can use this. Note the COUNTing of DICTINCT remote_ip_addr for every (GROUP BY) platform:

    SELECT platform
         , COUNT(DISTINCT remote_ip_addr) AS countDistinctIPaddresses
    FROM fuckedapps_dm_appdl dm 
    GROUP BY platform 
    ORDER BY countDistinctIPaddresses DESC
    

    After OP’s update. (it’s not good practise to alter the question by the way).

    It’s not clear if you want distinct app_ids for every platfrom:

    SELECT platform
         , COUNT(DISTINCT app_id)
           AS cnt
    FROM fuckedapps_dm_appdl dm 
    GROUP BY platform 
    ORDER BY cnt DESC
    

    or distinct combinations of (app_id,remote_ip_addr)s for every platfrom:

    SELECT platform
         , COUNT(DISTINCT app_id, remote_ip_addr)
           AS cnt
    FROM fuckedapps_dm_appdl dm 
    GROUP BY platform 
    ORDER BY cnt DESC
    

    Depends on what the wanted result is, say if you had one more row:

    uniqueID---remote_ip_addr----platform---app_id
    6           100.30.1.40       iPhone     23
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table which contains my server status create table ServerStatus ( ServerId
I have a table named categories, which contains ID(long), Name(varchar(50)), parentID(long), and shownByDefault(boolean) columns.
I have a table with the following columns [itemdate][itemID][itemspecialid] itemID contains a string with
In a SQL server database, I have a table which contains a TEXT field
I have an Oracle table which contains event log messages for an application. We
I have a contacts table which contains fields such as postcode , first name
I have a database structure that has a Person table which contains fields such
I'm currently dynamically building an asp:table which contains checkboxes these checkboxes have a CheckChanged
I have a database (NexusDB (supposedly SQL-92 compliant)) which contains and Item table, a
In a particular page i have a ascx control which contains a table. Now

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.