Category "group-by"

Field is not a stored field, only stored fields (regular or many2many) are valid for the 'groupby' parameter in Odoo 15

In the model, I added a Many2one field that is teacher_id and related to res.users, then i added teacher_gender that related to teacher_id.gender. teacher_id =

How to make null/none count 0 instead?

I have some sqlalchemy that counts rows with the value "3" and then prints out the count. It works fine if the count is 1, 2, 3, etc, but when there are no item

Get statistics for each group (such as count, mean, etc) using pandas GroupBy?

I have a data frame df and I use several columns from it to groupby: df['col1','col2','col3','col4'].groupby(['col1','col2']).mean() In the above way I almos

MySQL group rows

I have a table with: Id (id of rider) Time (is the time that he has done) Session (number session where the time was done) idlap idRider session time 1

Python calculate increment rows till a condition

How to obtain the below result. Sample Data with Output Time To default is the column which is to be calculated. We need to get the increment number as Time to

Pandas Group by index Hour and keeping observation for each hour

I have a pandas dataframe containing one column and a datetime index, i need to group the data by hour and keep each obsevation (record) for each of the grouped

I need to group (tbl_types.name AS type) in a same row (postgres 14)

I need help with a select in postgres, I need to group X types into a single line, for example: type: multiple, trully, I need help on the type column SELECT tb

How to create nested array inside $group in MongoDB?

After some of the aggregation pipeline stages, my MongoDB Document has the following format: { "key": "A", "status": "To Do", "val": 4 }, {

Using Distinct in Aggregate Select query

I am using oracle DB. I have a Aggregated script. We found that some of the rows in the table are repeated, unwanted and hence, is not supposed to be added in

How to calculate frequency percentages for a table using SQL?

Let's say I have some data as follows: ID data fingers rating 001 hello y 0 002 hello n 0 003 bye n 0 004 hell

Two-part conditional sql statement

The statement below is querying a log table and I'm trying to get the max budget depending on the scenario if falls within. Error message: Expressions referenc

BigQuery standard SQL: how to group by an ARRAY field

My table has two columns, id and a. Column id contains a number, column a contains an array of strings. I want to count the number of unique id for a given arra

How to pivot a table in Presto?

Let be a table named data with columns time, sensor, value : I want to pivot this table on Athena (Presto) to get a new table like this one : To do so, one ca

How do I group values to an array for the same field value in jq?

I have json data that looks like [ { "session": "ffe887f3f150", "src_ip": "81.71.87.156" }, { "session": "fff42102e329", "src_ip": "143.19

SELECT list is not in GROUP BY clause and contains nonaggregated column .... incompatible with sql_mode=only_full_group_by

AM using MySQL 5.7.13 on my windows PC with WAMP Server Here my Problem is While executing this query SELECT * FROM `tbl_customer_pod_uploads` WHERE `load_id`

expression not in aggregate or GROUP BY columns

I have a table that contains the following columns: ProductID, ProductName, Price, CategoryID. The goal is to print all the details (ProductID, ProductName, Pri

Spark pivot groupby performance very slow

I am trying to pivot the dataframe of raw data size 6 GB and it used to take 30 minutes time (aggregation function sum): x_pivot = raw_df.groupBy("a", "b", "c"

How can we use group by keyword on PIVOT table having dynamic column joined with another table or alternative query of Pivot

I have 2 tables named tblDemo and tblSubDemo; tblDemo havve 2 columns _id and _name. tblSubDemo have 3columns, ID,Name, Demo_ID(it is the primary key of tblDemo

SQL group by in Subquery

I'm trying to get monthly production using group by after converting the unix column into regular timestamp. Can you please tell how to use group by here in the

Calculating Percentage value for a Group by value in Postgres

I want to calculate Percentage of a value in Group by. My Table data salesId salesAmount productName salesTyp ------- ----------- ----------- ----