I have two tables that I’d like do a full outer join where the resulting view separates the values table into two separate columns with one row for each name_id. I have made one approach with a CASE expression to select by type and then use it with pandas to fill in the values and return distinct name_ids. Name Table
Tag: aggregate
grouping equal values – aggregate function problem
I’ve created a table that lists venues in which several events take place. The same event in the same venue can have a different price. The last column calculates the total revenue for one venue. venue event totalprice sum Venue A Event A 5 30 Venue A Event A 10 30 Venue A Event B 5 30 Venue A Event
SQL duplicates despite grouping on all key variables?
I am new to SQL and use it for work, so I am going to censor the real names of columns going forward in the query below. I am writing a query where the necessary data is spread across 3 tables. I have a network with users who send and receive packages from different nodes, and I want to see
SQL Create a new calculated column based on values of multi rows and cols
I have a data about airline’s booking, using Oracle db, sample is structured as below: Recordlocator is booking code Sequencenmbr: whenever there is a change in booking, it records new status of a booking with higher Sequencenmbr. So the highest Sequencenmbr in the database shows the latest/current status of bookings Sequenceair: is the sequence of flights in bookings, it may
Sum of two counts from one table with additional data from another table
I have two tables as follows: I want to get the sum of two counts, which are the number of true values in col_a and number of true values in col_b. I want to group that data by user_id. I also want to join Table B and get the name of each user. The result would look like this: So
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
SQL: Use LEAD() and PARTITION BY to access to the next row following the current row
I have a mobile app browsing history dataset as shown below. DeviceDateTime: Date and Time the User views the page in the mobile app. UserID: each UserID represents a visitor who login the mobile app. PageName: There are different pages in the Mobile App. All visitors would first land on the Home page, and then navigate to different pages. PageSequence:
Calculating average with biginteger time intervals using TimescaleDB
I have a schema with the following fields: Name of row | Type ————————–+——– name | string value1 | numeric …
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