Skip to content

Tag: sql

Processing mulitple similar rows in Pandas

I have a dataframe pulled from a relational database. A one-to-many join has resulted in many similar rows with one column different. I would like to combine the similar rows but have the differing column data contained within a list, for each unique row. I am also able to change the SQL but I think this may …

CosmosDB count using OrderBy multiple conditions

I am using Azure CosmosDB, the model contains Id, and creationTime properties. What I am trying to do is count entries within time interval. I looked how to achieve it using LINQ but could not find a solution. What I used than is SQL. This is what I tried: Bare in mind the values i showed are for display purp…

Select all rows which match a condition dependent on over rows

Let’s assume I have a table T with the columns X, Y, Z where Z is some comparable value (I have to make it work on a PostgreSQL database but a solution that additionally supports oracle would be even nicer). What I want to achieve is best described by the following, sadly invalid query: This is invalid …

How to short a sql case query that uses between

Hi have this sql query: How can I short this query so I don’t use a lot of case statements? Answer You can try using mod subtracting the remainder t from you value by division for 1000 or as suggested by @DM you can also use the difference should be the same .. both involve function .. but there are