Skip to content
Advertisement

Tag: count

Count and Group by 2 different columns SQL

I have below table and want to find out a count and group by that will show the number of times republic of ireland played a particular opponent regardless if they are the home team or away team I want something that will show like the below Thanks for help! Answer This is how I would do it — normalize

How can eliminate the line that counts everything [COUNT function in SQL]

I was running a code where I needed to see the top 10 results in a table. Unfortunately, I am with one more row that I was expecting. My results was the following: [Result after the query][1] [1]: https://i.stack.imgur.com/KCu7W.png Is there any way I can eliminate row 1 from my query? Thank you in advance for any assistance! Answer try

Count users with a condition in MYSQL

I have a table ‘helpdesk’ (detail below) that lists tickets. I’m trying to get the top 10 users who report issues, however there is a complication in the fact that users can report an issue for another user (think secretary for their boss as an example). The table structure is… Using the example above the count should return User 1

SQL to find local count max per primary key

I have a table with PK CustomerId + type. Each customer has a few types. For each customer I want to get type which repeated the most for this customer. I’ve tried to create a column “count” but I want to get the local maxs, and not a global max for the whole col. Is there a native way to

How do I aggregate data in sql for multiple rows of data by column name?

hi im new to sql and trying to understand how to work with data structures. I have a table If the interaction userkey number repeats then, i want a column called number of visits. in this case, for interactionuserkey 5, there are 2 total visits since its repeated twice. for interactionuserkey 0, number of visits =1 and so on. Basically,

How to get distinct parent_sku count for the below dataset?

Need your help to extract distinct Parent_sku count from the below data set. Condition: If one child of a parent_sku has “High” sales_tag then that parent_sku count should be excluded from “Low” sales_tag. P.S. Sales_tag column is based on child_sku column. Thank you for your help. Dateset_&_Output Answer The presented schema is non-conducive to this type of query, however we

Advertisement