Questions tagged [join]

A SQL JOIN clause combines records from two or more tables in a relational database.

Filter by
Sorted by
Tagged with
2
votes
0answers
108 views

Spark Scala: SQL rlike vs Custom UDF

I've a scenario where 10K+ regular expressions are stored in a table along with various other columns and this needs to be joined against an incoming dataset. Initially I was using "spark sql rlike" ...
1
vote
0answers
42 views

Creating Quantile Cutoffs using SQL Hive

I have a table in Hadoop that looks like this (with up to hundreds of columns and millions of rows): ...
2
votes
1answer
240 views
4
votes
2answers
58 views

Acquiring earnings information

The first part of the query grabs Policy's Premiums, Effective and ...
4
votes
1answer
67 views

Finding optimal mapping patterns that transform relational data into a linear format

I'm trying to upgrade my javascript to be more functional. I have used function composition and curry successful on less complicated code but i'm now running into a point where i'm not sure on how to ...
5
votes
1answer
159 views

Update join table using list of checkboxes in Rails

I have Gig and Singer Active Record models (standard--no customization just yet) with a many-to-many relationship through a ...
1
vote
1answer
25 views

MySQL GROUP BY id, then show name

I have a users table where some users have the same name: ...
2
votes
1answer
71 views

Join and pivot multiple tables of securities data in MySQL

I'm interested in a way to join three (or more) tables in a way that is more efficient (both in terms of conciseness of code and in terms of generating the results) than what I have currently. ...
3
votes
1answer
57 views

Python script to find employees who are in one PostgreSQL table but not in another

I'm writing a python script and do database query to get the ids of employees who are in one table but are not in another. I'm using psycopg2 module for python 2 and PostgreSQL as database. After ...
4
votes
1answer
185 views

SQL query to count loans issued during each week

Calculate the number of loans issued by the Regional offices for each business week in the period from 38 to 40 business week of 2011 inclusive. Sort by name of the regional unit, business week. ...
5
votes
1answer
39 views

Merging client names into orders using RxJS

I have an API which I can't modify. I have to use data as it is. I want to join data from two separate requests where the second request is based on data from the first one. I have a working ...
1
vote
1answer
54 views

Query to generate payroll based on attendance for a month

I have written a query to generate payroll based on attendance for a month, for about 4000 employees. It takes quite a long time to execute. Basically, what I am doing is to joining two different ...
3
votes
2answers
209 views

VBA code to import data, doing lookups to detect duplicates

I have an import macro, which creates ID by concatenating cells, then I compare using VLOOKUP with another sheet if any duplicate found. It's running very slowly, so I want to know better ways to ...
1
vote
1answer
78 views

Merging records from one spreadsheet into another

I have created the code below that compare two spreadsheets . It initially compares the range of value from sheet1 ("Status") to sheet2 ("Interface") . Whenever a range matches with the ranges present ...
1
vote
1answer
38 views

Listing people with their phone numbers (if any)

I have the following tables in my database: ...
2
votes
1answer
2k views

Conditional joining Pandas dataframes

I'm looking for an optimum way to join two Dataframes where the same record exists in both. Examples would be: ...
3
votes
0answers
74 views

Sequential master update

I'm creating a version of the classic sequential master file update in java. This is used when you sort two files by the same key for updating one file with the other. In this case, I'm pulling in all ...
1
vote
0answers
35 views

SQL self-join to label nodes on binary search tree

Would like feedback on my SQL (1) efficiency and (2) readability, and if the conditions I featured in my CASE statement could be transferred to a join, etc. Here'...
2
votes
1answer
54 views

Joining tables by skipping the intermediate parent table [closed]

We've tables adm_app, quals_data to which personal_data is a parent table. We are retrieving ...
5
votes
4answers
5k views

Java8: Stream filter, map and joining with an alternative result if the stream is empty

Given a list of integers, I would like to: filter odds numbers produce a list inside brackets: [n1, n2, n3] if the list is empty it should be a dash ...
6
votes
1answer
14k views

Using LINQ to perform a LEFT OUTER JOIN in 2 DataTables (Multiples criteria)

I know that exists a lot of solutions about how to create an OUTER JOIN between two DataTables. I created the following code in ...
0
votes
1answer
535 views

T-SQL query outer apply with nested subqueries

I have the following 3 tables, and I don't have the option to modify them. [Logs] table with [log_type], ...
3
votes
1answer
850 views

Mapping key value pairs between two JavaScript objects

I have two JavaScript objects: ...
3
votes
1answer
86 views

Project management query for various organizational units

I use the code below to calculate the required information from other tables. I used joins to display names instead of IDs and to get required sums from other tables. I used ...
10
votes
3answers
21k views

Extracting data from text file in bash using awk, grep, head and tail

I've been writing bash script on and off, with pretty good results in terms of getting the job done. However, I'm worried that my script might be very ugly, as I am a beginner. I'm looking for advice ...
2
votes
1answer
50 views

Comparing data in SQL using foreign keys

The following is given: ...
0
votes
2answers
11k views

MySQL JOIN to JSON array

I'm building a HTTP API and this part should return a JSON list of posts and their attached photos, like this: ...
2
votes
1answer
42 views

Inner Join only if satisfies If condition

I'm looking for code review, and optimizations. I have two tables ItemCategory and ShopItemCategory ItemCategory ...
2
votes
3answers
33k views

Inner join with first result

In SQL Server, there is two tables: Houses, and their images. I need a list with 20 houses with the first of their images (only one). I tried: ...
1
vote
1answer
44 views
3
votes
1answer
1k views

Joining WorkTypes to WorkGroups via Channels and Users to check authorization

I need to select some "work types" from a channel. These "channels" are in "work groups" and both channels and work groups need to have permissions to view them (tables are ChannelUsers and ...
1
vote
2answers
81 views

SQL-style join on arrays using ECMA6

I have a code snippet which performs an SQL-style join on objects in two arrays based on a specific field (in the code below, .id). ...
7
votes
3answers
225 views

Linking two databases based on street addresses

For my work, I wrote a python script to link 2 files. Since I am an autodidact and since no one of my colleagues writes code, I ask the question here. My code takes an unbelievable time to run. Is it ...
0
votes
1answer
109 views

MySQL query to select messages related to a user

Could someone please check my query and the table structures and let me know if there is any way to improve it. I would like some tips for my own personal development Query in PHP: ...
31
votes
6answers
6k views

Counting rows in a CSV file that correspond to a database row, each with a million records

I have two DataTables: dt: is populated from a CSV file with over 1.7 million rows dataStructure.Tables["AccountData"]: is ...
7
votes
1answer
75 views

Joining a product-application-customer relationship using Java 8 Streams

I have three classes: product, customer and application. The schema of these classes are as follows: ...
1
vote
1answer
3k views

Selecting employees in certain departments using LINQ

I am trying to select the DepartmentName from Employee Table based on where condition. Is any way to simplify the code? ...
4
votes
1answer
56 views

Counting penalties for each player by joining tables, where some of the data is null

I have a table full of player names: I also have a table full of player penalties: I have to list all of the players names, player numbers, and the number of penalties that they've incurred. To do ...
4
votes
2answers
148 views

Loading objects for users, roles, and groups from a query with LEFT OUTER JOINs

I have this function that returns me a list of users with their roles and groups. As you can see, this is how I fetch and create list of objects. I'm wondering whether this is a good approach and what ...
1
vote
0answers
200 views

Join via navigation properties with collection

There are some related collection objects in my table and I'm trying to get list with joining this tables. But this code is seems bad: Entities that shortened: User: ...
2
votes
0answers
37 views

Counting items that have a matching attribute

Here is my code which is going to through multiple for loops to get the matching product attribute. I have single product with attributes trying to find out the ...
7
votes
4answers
455 views

Using LINQ to group social networking links for each user

I have a model named User. Each user can have some social links. Now I want to get all users with their social link as a single row in the result. Here are my ...
3
votes
1answer
71 views

Archiving an SQL table of sessions and statistics

What my query is doing: I have two SQL tables and I want to copy datarows from the one table to the other table. I am doing this for statistics. The source table includes all current member-sessions/...
5
votes
2answers
110 views

Matching maximal nodes with velocities

I have written a code which works very good for small data-files (see below). The data file 'WSPL.dat' which I want to evaluate has a size of 2.6 GB and the data file 'VELOC.dat' has a size of 4.3 GB....
3
votes
1answer
88 views

Gather information about computers from multiple CSV files

I created a script to import several CSV files from various sources and one CSV file with a list of systems in it. the script searches each CSV file to see if the system exist in the file and if it ...
2
votes
1answer
1k views

Cross context joins in .NET

This is how I made a cross context join. What do you think? How would you do this better? ...
1
vote
1answer
55 views

Rails query for all questions in tournaments that a user participates in

I'm new to rails and this is the situation I'm in: I have a User model that has many tournaments, a Tournament has many users ...
3
votes
1answer
68 views

Filling in gym membership prices by joining PANDAS dataframes

I have two dataframes, df which contains a list of members in addition to the type of contract that they purchased on a given date, ...
6
votes
1answer
6k views

Python search for array in large text file

I asked similar question at: https://stackoverflow.com/questions/38410982/superfast-regexmatch-in-large-text-file ...