Below is the output of cumulative frequency according to datewise, which I want to change into the subquery. The output is also correct but I want to do it by using a subquery. OUTPUT Answer You would use window functions: Not only is this simpler to write, but it should be significantly faster — and no CTE or subquery is
Tag: mysql
How can I use a FULLTEXT query with MySQL to return all results matching a string?
This is the table videos: I currently have this query: I want that query to return all results with the string not in it but it is only returning 1 result instead of 2. What is the best way to get it to return all matching queries instead of only 1? Edit1: If I use the WITH QUERY EXPANSION modifier
SQL Compare employees by gender in different departments
I need help to write a query that compares the number of male managers and the number of female managers in each department. tables are as follows. — Departments ————————— | dept_id …
calculate upcoming category based on the dates of the past categories [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 1 year ago. Improve this question I have the above table structure in the database and I want to calculate the upcoming abbreviation for an id (if a particular abbreviation has
How to count “Sunday” of the month to count absent employees
I have a problem calculating employee absenteeism in a month. In my query it still counts the day of the ‘sunday’ in this month, which shouldn’t count. This is an sample database used : emp0003 table’s NIK Name 01190301 Susan dvc0004 table’s NIK Enroll 01190301 2021-02-08 07:20:39 01190301 2021-02-06 14:37:08 01190301 2021-02-06 07:57:42 01190301 2021-02-05 17:29:00 01190301 2021-02-05 08:09:54 01190301
Dropdown selection based on other dropdown [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 1 year ago. Improve this question I am working on a webform that will allow the user to simulate a purchase of a movie ticket. The date/time should change dynamically based
Sum values from 2 joined tables even if id’s don’t match
I’m trying to take two tables, join them together based on their contract numbers and then get a sum of each customers contract amount between two years. However, some of these contracts were from an …
Multiple ids in a unique column each and joining them to get details of each on the same line
I’m having in one table a master_id, and student_id. I want to write a query that would print out both the names of the master and student on the same line while joining their details from another table. master student table assignments table So I’m trying to write a query that would return the results from the assignment table like
Filter results by user role
I have a query that returns the total number of users per a specific meta value (gender), considering only users that are not blocked (user_blocked_access): I have to return only the results for a specific user role: But don’t know where I should adds this part of code. Answer You can add an additional JOIN: Note: This assumes that there
How to mirror auto increment value and combine with value in another column in mysql
I have an auto increment column id in a table, this works fine but I am trying to create an order_id column that combines the account_id of a user with the auto increment value of id. So the values inside order_id look for example like this: Where the number before the dot is the account_id and the number after is