I have two tables Range and Employee. Range table consists of columns (Available programs for that salary like platinum and silver etc). Employee table has columns https://i.stack.imgur.com/RKaXP.png I want to write a SQL query in such a way that it gets the count of employees who fall under the given salary range in range table, please refer screenshot for tables
Tag: count
How to count multiple columns in SQL (Oracle) with criteria?
I’m working on SMS-Gateway that holds multiple charged SMS-services with different numbers, each SMS sent to the customer has 4 status as below (forwarded, delivered, expired,delivery failed) Now I have the below first_table for the charging-system with the below details (TABLE-A) and below (TABLE-B) which contain the status of each sent SMS with its ID Below is my expected final
SQL query cannot use NOT LIKE to get results
I am starting out in SQL and am trying to do a query that will select all event names that are unique and do not have ‘TODAY-XXXXXXXX’ in the value for the event_name column. I have a query that works …
MySQL: Counting active products that belong to active categories (and optionally to active subcategories)
i’m using MySQL 5.6. I need to get a list of categories, with a product count column. So far, a very easy and trivial task. Here’s where it gets a little complicated: A product has a category, and can also have a subcategory (optionally). Categories, subcategories and products can be active (flg_public=1) or disabled (flg_public=NULL). So, the query should return
How to calculate percentage in group by with condition?
I have a table with this schema: I need to know percentage of failure for example: google -> 50% failure Facebook -> 100% failure I use mysql 5.7 I tried to reach this destination using group by, but I couldn’t Answer You can do conditional aggregation. I like to do this with avg(): For each provider, this gives you a
How to COUNT “accounts” only if character/user exist
I have 2 tables – “accounts” and “players” I’m using this query to COUNT accounts Accounts table estructure: Players table estructure: * Let’s say the query counts 10 accounts but only 3 accounts have a character/user created. I would like to know how to count only those 3 accounts without taking in consideration how many characters/users has the account, so
Incrementing count ONLY for duplicates in MySQL
Here is my MySQL table. I updated the question by adding an ‘id’ column to it (as instructed in the comments by others). I want to add a new column called row_num to assign an incrementing number ONLY for duplicates, as shown below. Order of the results does not matter. I followed this answer and came up with the code
Counting number of occurrences of a value resulting in “Mismatched Input” error?
So, I have a table where a bunch of people took multiple surveys. Each survey had a rating out of 10. I need to find the average per survey (which I’ve already done) and also the number of 10s that …
Selecting different parameters for a group by statement in mysql?
I have a dataset like this: Here in this dataset, there is No NULL value for all these 3 columns, also user_name and recording_msid pair can repeat but each repeated pair will have a distinct …
How to display values from different tables in certain time frame MYSQL
I have attached the tables that are included in this question for MYSql. My question states: First and last names of the top 5 authors clients borrowed in 2017. My code so far: I think so far my code just displays the top 5 Author ID in 2017 but I can’t figure out how to display the names. I see