Big Query: I’m looking to assign a ‘unique combination id’ if a person and date are an exact match. So for each specific time a ‘person_id’ and a specific datetime are the same, they are assigned a number overall (time will always be 00:00:00 but just has to be there for records). This will be a unique number overall, not
Tag: combinations
Generate all combinations of values with set list of values for each character in SQL
I have a dataset that looks like this Position Value 1 1 1 2 1 3 2 8 3 5 3 6 And I’d like to generate all combinations of strings with the value at each position. For this example, the output would look like Output 185 285 385 186 286 386 The order doesn’t particularly matter. Note: There can
How to create new count column based on adjacent combinations in existing table
I have a simple table I’ve already built in BigQuery and all I want to do is what feels like a simple count of the number of times the combination of the person_id and the specific activity in the activity column has appeared in that table and create as a new column with a value/count of the adjacent combination in
Store Pricing Combinations and Sums w/ SQL
I have a table that looks something like and I would like to create all possible combinations with the sum of the prices, including the unique values to create something like what would be the quick and dirtiest way of accomplishing this? Answer Use three joins:
SQL, how to group rows based on field values
i have question about query result group. The image is a example. it is cable list. Each cable come with two attributes, ‘From’ location and ‘To’ location. if we’d like to group the cable list by …
Oracle: how to get unique combinations of 2 sets
sample data: Data looks like group: 1 set: 1,2,3 I want to get all combinations of this 2 tables but UNIQUE ( 1,2,3 it’s same as 1,3,2), so output would be like this: I tried using connect_by_path, but it get’s me or same combinations (like 1-132) or some combinations are missing. Any ideas? Answer Assuming that you don’t have duplicated
Better solution to index a DataFrame according to the values of 2 others
I would like to index a DataFrame (aaxx_df) according to the values of 2 others (val1_df for the columns and val2_df for the rows). I put below a solution that works for my problem, but I guess, there must be some much cleaner solutions, possibly via SQL (it seems to me to be very similar to a relational database problem).
Unique combination of records in a SQL table (Get edges from nodes table)
I came across a use case where I wanted to generate a combination table where the attributes of a record had to be matched with all other records in the table. Something like creating list of edges in a Complete Graph using a nodes table. To give you an example of the requirement, you can consider the following table (Postgres).
SQL – find all combinations
From a dataset like this, I need to get all possible combinations of cases in the same room so that no case overlaps another. The expected result is I am able to get single line results of what case can be combined with which other case like: And I’ve tried some recursions but I am at a loss nowhere near