Category "group-by"

How to fetch only CH_PAY_MODE loan_id from this table?

loan_id coll_date coll_pay_mode 8007571771 APR-2022 CH 8007571771 FEB-2022 CH 8007571771 JAN-2022 CH 8007571771 MAR-2022 CH 8007571771 MAR-2022 CL 8007571771 M

Calculate changes in totals of subgroups in R

I have the following dataframe: # A tibble: 8 x 5 Year Group Unit Profit Sales <dbl> <chr> <chr> <dbl> <dbl> 1 2021 One

SQL Moving window over two level of groupby

I have the following table of orders for users like the following: CREATE TABLE orders ( order_id UUID, user_id UUID, date date,

Is there a way to check that none of the rows in a grouping contain a value?

I have a query that looks like this: SELECT ordDetails.OrderId FROM orders.OrderDetail ordDetails WHERE ordDetails.Class <> 'O' GROUP BY ordDetails.

Fetching values from one column based on other column keys in long-formatted dataset

I have a long format dataset of 100,000+ individuals, capturing clinic visits at 5 different time points (not chronological). I've included an example dataset b

Taking Second Value with Case When in Hana Tables Join Condition

I have event, cases and roads tables. I want to join these 3 tables but i have a problem because there is two different road_id which matched same firstpoint, l

Making a MySQL COUNT query

after 4 days of tries and researchs over the web I can't make my wishes working. Any help would be appreciated !Performed on MYSQL WORKBENCH I got a DB made of

Retrieve the last value of each data group - Oracle SQL

I’m having trouble on a query right now to retrieve only the last value saved for each group of results. I explain myself with a table. I have these value

Group by id and create a column based on priority in Pyspark

Can someone help me with the below. I have an input dataframe. ID process_type STP_stagewise 1 loan_creation Manual 1 loan creation NSTP 1 reimbursement STP 2

How to do Group By and SELF JOIN in single table

Here is what I am trying to get done. Partly I am thru, Partly I am stuck, and need some help. Table structure: CREATE TABLE UserRole ( Id bigint NOT NULL A

Athena count/Sum column divided by count/Sum column returns zero

I am trying to find percentage based on id column. issue - I am trying to use count(column)/select count(column) from table which is giving output as 'Zero' Tab

How to do rolling sum with conditional window criteria on different index levels in Python

I want to do a rolling sum based on different levels of the index but am struggling to make it a reality. Instead of explaining the problem am giving below the

What is the best practice to query this type of data in laravel?

I have 3 tables structure like below:- products id name 1 apple 2 orange branches id name 1 Branch 1 2 Branch 2 stocks id branch_id product_id qty 1

Group unique values in r

I have a following data: I want o summarise the data in three columns by Subject type and other two columns sates number of schools and number of students by ea

SQL Group/Orderby

I have a set of records in a db table like this. The thing that logically links these records is guid1 and guid2 but not all records in the table have a full re

How to add new column to pandas group? Pandas forgets the column

I have a pandas dataframe indexed by createdAt grouped by pid (participant identifiers). The created at column are unix timestamps. Now I would like to add a ne

EF Core group by date and count value for previous dates

I have a table like Date Balance A Balance B --------------------------------- 2022.03.01 100 200 2022.03.01 200 500 2022.03.02 300

How to groupby two columns, not considering order of values there?

I have a dataframe: val1 val2 val3 a b 10 a b 2 b a 3 f k 5 f k 2 when i do df.groupby(["val1", "val

Need to show Largest Purchase and the date and Last purchase/date and it is not correct

I am only working with two tables. One is a list of IDs (Accounts that i need to find the information on) I am looking up those ids in another table (purchases)

SQL- Find all students who all of their friends have score less than 10

I have to write some simple queries for my database homework using SQLServer. The schema has been provided in the question: students(student_id, name); friends(