Skip to content Skip to sidebar Skip to footer
Showing posts with the label Gaps And Islands

Using Inner Join To Determine The Interval Between Specific Records And Related Events In A Table

I have a simple table that is used to record events against specific visits: Describe Histories; … Read more Using Inner Join To Determine The Interval Between Specific Records And Related Events In A Table

Sql Or Linq: How Do I Select Records Where Only One Paramater Changes?

Say we have this list: Id IdRef myColumn anotherColumn 448 70 1 228 449 … Read more Sql Or Linq: How Do I Select Records Where Only One Paramater Changes?

Enumerating Table Partitions In Postgres Table

Suppose I have a table like this: id | part | value ----+-------+------- 1 | 0 | 8 2 | 0 … Read more Enumerating Table Partitions In Postgres Table

Tracking A Continuous Instance Of Absence Sql

I have a table called sickness which is a record of when an employee is off work sick. It looks lik… Read more Tracking A Continuous Instance Of Absence Sql

Sql Server 2014 Merging Overlapping Date Ranges

I have a table with 200.000 rows in a SQL Server 2014 database looking like this: CREATE TABLE Date… Read more Sql Server 2014 Merging Overlapping Date Ranges

Sum Two Rows And Order By Date / Total

need some help to build a query, this is my current scheme: users: +----+------------+ | id | user… Read more Sum Two Rows And Order By Date / Total

Group Consecutive Time Intervals In Sql

Assuming a data structure of the type stock_name, action, start_date, end_date google, growing, 1, … Read more Group Consecutive Time Intervals In Sql

Sql Query To Return Nil For Dates Not Present In The Table

I have a table 'my_table'. It has the following data : ID --- Date 1 --- 0… Read more Sql Query To Return Nil For Dates Not Present In The Table

Merge Two Tables Based On Time

I am new to Oracle SQL. Please help me with this problem by giving me solution in Oracle SQL only. … Read more Merge Two Tables Based On Time

Select On Value Change

I have a table that looks like this in a MySQL database: CREATE TABLE IF NOT EXISTS Example(Batch_N… Read more Select On Value Change

Postgresql Given "1,2,3,6,7,8,11,12,15,18,19,20", A Query To Return The Maximum Of Each Group Of Consecutive Numbers

given 1,2,3,6,7,8,11,12,15,18,19,20, write a query to return the maximum of each group of the conse… Read more Postgresql Given "1,2,3,6,7,8,11,12,15,18,19,20", A Query To Return The Maximum Of Each Group Of Consecutive Numbers

Mysql Week() : Get All Weeks In Date Range (with/without Records)

Here's an sql query I am using to get count of records in a table separated by week (only date … Read more Mysql Week() : Get All Weeks In Date Range (with/without Records)

How To Select Sequential Duplicates In Sql Server

I would like to select duplicate entries from a SQL Server table, but only if the id is consecutive… Read more How To Select Sequential Duplicates In Sql Server

Determine Contiguous Dates In Sql Gaps And Islands

I have a situation where a single patient can receive multiple services. These services can have o… Read more Determine Contiguous Dates In Sql Gaps And Islands

Calculate Time Between On And Off Status Rows Sql Server

I´m using SQL Server 2008, how can I calculate the time between On and Off status? I have the follo… Read more Calculate Time Between On And Off Status Rows Sql Server

How To Split Data Into Groups In Pyspark

I need to find groups in time series data. Data sample I need to output column group based on val… Read more How To Split Data Into Groups In Pyspark

Query Records And Group By A Block Of Time

I have an application that may be run several times a day. Each run results in data that is written… Read more Query Records And Group By A Block Of Time

How To Retrieve Only The Records Where Stat Changes?

I want to get same output: using the following sample data create table x ( id int, dat… Read more How To Retrieve Only The Records Where Stat Changes?

Return Duration Of An Item From Its Transactions, Many To Many, Sql

Hopefully I can get some help on this. Situation There are two incoming stations and one outgoing s… Read more Return Duration Of An Item From Its Transactions, Many To Many, Sql

Sql: Gaps And Island Problem - Date Not Consecutive Causing Rank Inaccurate

This is a follow up on the other question I asked. Quarter Segment Customer *Counter* … Read more Sql: Gaps And Island Problem - Date Not Consecutive Causing Rank Inaccurate