Questions tagged [group]

585 questions
-1
votes
1 answer

SQL - Query with count / string_agg

I have the following table: Source I want to get this table: Destination I want to get all COL1 having at least 2 distinct COL2 values and to display in the COL2 of the result the distinct COL2 values with the count of all the corresponding COL3 in…
Yann
  • 1
-1
votes
1 answer

How to create a variable that counts the number of occurrences of another variable (1 for first occurrence, 2 for second etc)

I have this data: #id time #1 1 #1 2 #2 1 #2 2 #2 1 #2 2 #3 1 #3 2 And I want to create a variable that looks at the id and time combination and puts a 1 the first time it sees it and 2 the second time it sees it. So this occurrence…
Victor Nielsen
  • 443
  • 2
  • 14
-1
votes
1 answer

how to group by nama and filter with condition in mysql

I have data table and i want to get datain based on date between, catagory and group by part id , i found problem when value part_id same tblpart part_id category ok ng total datein part 1 regullar 5 1 6 2023-01-02 part…
garikarta
  • 1
  • 2
-1
votes
2 answers

Grouping and sum up all values per day, month and year in SQL

I have a table like this: "time","value" "2023-01-28 01:00:03.520","741" "2023-01-28 14:14:30.520","509" "2023-01-28 14:16:07.238","584" "2023-01-28 14:17:49.630","562" "2023-01-28 14:19:28.024","572" "2023-01-28 14:21:10.336","569" "2023-01-28…
test
  • 51
  • 5
-1
votes
1 answer

Use C++ to find a Cyclic group with prime order

How can I use C++ to find a cyclic group of prime order? I require the element of this group to be 128 bits. In need to find this kind of group to execute cryptographic operations.
zhen liu
  • 13
  • 1
-1
votes
1 answer

Sum column values within the same group and save that dataframe separately

Let's say I have a dataframe that looks like the following: In [186]: df = pd.read_csv(file, engine='python',sep='\t') df Out[186]: length value parent 100 5 X 90 18 X 77 17 Y 15 15 Y 89 …
JJbox
  • 3
  • 2
-1
votes
3 answers

Select the oldest record of a certain group until it changes pattern, in SQL

I am trying to get the oldest record for every status update/change in the following table. Table (status_updates)…
Tanmay
  • 13
  • 2
-1
votes
1 answer

Using Pandas with python to code a small program to display percent of times each car did not stop for gas

what I currently have displayedHelp using Pandas with python to code a small program to display percent of times each car did not stop for gas (represented with NOT) . Using df.groupby and .value_counts to display pic you see. there are only two…
-1
votes
2 answers

Group JavaScript Object by group id

I have a JavaScript object as below: [{ "id": "41e4858d-0478-4ffa-b39a-73db6f80c493", "price": 10, "class": "audi", "group": { "id": "group-1", "name": "Special", } }, { "id": "d4ed6efe-3d95-4f19-9f34-16b1d62ee5f1", "price":…
baharat
  • 3
  • 2
-1
votes
1 answer

Adding new column from Inner join throwing back Invalid Identifier Error

I have a working script and would like to add the column 'Product_Hier_2_l2_Name' from a table called b_product. When I add the Column Oracles throws back the error: ORA-00904: "P"."PRODUCT_HIER_2_L2_NAME": invalid identifier 00904. 00000 - "%s:…
-1
votes
1 answer

How to group lists according to at least one element in common in Python?

I have a list of lists and I want to group them according to at least one element in common for at least two sublists of a group. Therefore, each sublist in a specific group doesn't need to have an element in common with every sublist in its group,…
Marlon Teixeira
  • 334
  • 1
  • 14
-1
votes
1 answer

Aggregating data by groups

I have this…
Trevor M
  • 89
  • 9
-1
votes
1 answer

Only display first instance of event for each unique person

I have a table below (that also has several other columns, but for the purpose of this example, I'll exclude them) where I only want to include the very first instance for each person (unique_id) by date, which is in DATETIME format. In the past…
Raven52
  • 77
  • 11
-1
votes
1 answer

How to use left join in SQL to extract results?

The task is to generate a summary that consists of sums of the value of goods imported and exported by every country. Note that when a company buys some goods, it contributes to its country's total import, and when the company sells some goods, it…
-1
votes
1 answer

GROUP BY statement throwing errors tutorial isn't

Hello im going through a tutorial on SQL joins and this statement below is throwing "sql_mode=only_full_group_by" error. I copied this directly from the tutorial and its working for him. Do I just need to disable this mode in the terminal? …
Jimmy6In
  • 1
  • 4