I have data that looks like (over 100.000 rows): What I would like: Explanation CONTEXT I want to find out how many people (person) are working in the same location (Location) by looking at a time window (timestamp) of max 10 minutes and checking whether a person is really working simultaneously or just taking over their shift within that frame.
Split Characters in a cell to individual columns [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 5 months ago. Improve this question I have a dataset where a column contains 1 and 0 in a single cell which reference security authorities in a software program. I need
Joining 2 Queries without Common Column Fields in SQL?
My issue is in reference to a similar post: Joining tables without a common column in sql server I have 2 queries, each query references different tables, hence the queries do not have common column fields. I want to join the 2 queries together. Let’s take for example the 2 queries has the following data: Query1 Query2 Expected Query3: The
SQL Query to check not repeated values
I’m new to SQL. I wanted to know, How to check the entries which are not repeated for the other entries. Better I give one example. column1 column2 a 1 a 2 a 3 a 4 b 1 b 2 b 3 b 4 c 1 c 2 c 3 I want output as column1 column2 c 4 because c
Include zero counts when grouping by multiple columns and setting filters
I have a table (tbl) containing category (2 categories), impact (3 impacts), company name and date for example: I want to get the count of records for each category and impact and be able to add rows with zero count and also be able to filter by company and date. In the example result set below, the count result is
Get movies that have categories
I have associative table movies and their categories. How can i get movies that have category 1 and 2? Result: Answer Do GROUP BY. Use HAVING with COUNT DISTINCT to make sure both 1 and 2 are there. Just for fun, you can also do a self join: Or, use INTERSECT:
Laravel – Get sum of a column without querying to database more than once
My table structure is like this: but now I want to move the gift to another table since the gift can be given to the users more than once in different dates. I have used $user->gift in many places in my project and I don’t want to change the code. So I want to create a method in User model
SQL to append records
I have two tables tbl1 and tbl2. Consider tbl2 as the main set and tbl1 has been derived from other sources but will essentially now be a subset of tbl2. tbl1 cd productcd type 1 1 A 1 2 AB 1 3 A 2 3 AB 2 4 AC 3 1 A tbl2 cd productcd type priority 1 1 A
How to Get Count(*) and table data based on where condition in single query
I’ve a stored procedure like this: In the above ex I’ll be getting the table data and the Count of total rows based on where in two queries. This is working fine, but in my actual case the select query is large and calling it twice, once for table and second for count like above is costing time. Just wondering
I wanna create a new table from the data of two tables
I have a A table to store the product name, the quantity and input day of goods in stock. In adverse conditions, invoices for the above products will be sent later. I will put the product name and invoice quantity in B table. The problem here is that I want to check the quantity of goods with invoice and without