Skip to content
Advertisement

Tag: aggregate

Aggregation level is off (Postgresql)

I have Order data for 2 customers and their order. And I am trying to calculate what the sum for the price is for every customter for that specific order only for product N Table: This is my query: For some reason I do not understand it gives me several rows per same customer. I am trying to get only

Data aggregation by sliding time periods

[Query and question edited and fixed thanks to comments from @Gordon Linoff and @shawnt00] I recently inherited a SQL query that calculates the number of some events in time windows of 30 days from a log database. It uses a CTE (Common Table Expression) to generate the 30 days ranges since ‘2019-01-01’ to now. And then it counts the cases

JOIN with OR condition and use only MIN(Column)

I have two tables. Certain values from table t need to be matched with certain values of table m in order to identify a target value from table m. Table t looks as follows. Table m looks as follows. The logic should be as follows: Column A from table t should be matched with column matchA from table m and

Group by question in SQL Server, migration from MySQL

Failed finding a solution to my problem, would love your help. ~~ Post has been edited to have only one question ~~- Group by one query while selecting multiple columns. In MySQL you can simply group by whatever you want, and it will still select all of them, so if for example I wanted to select the newest 100 transactions,

Advertisement