tagged [join]

Join one row to multiple rows in another table

Join one row to multiple rows in another table I have a table to entities (lets call them people) and properties (one person can have an arbitrary number of properties). Ex: ## People ## Properties ``...

23 May at 19:11

How to execute my SQL query in CodeIgniter

How to execute my SQL query in CodeIgniter I have a problem with my query and now my problem is how can I execute my query. I got my syntax format from here [http://www.x-developer.com/php-scripts/sq...

MySQL LEFT JOIN Multiple Conditions

MySQL LEFT JOIN Multiple Conditions I have two tables: A and B linked by "group_id". 2 variables I'm using: `$keyword, $_SESSION['user_id']` group_id keyword id group_id user_id I want to be able to s...

7 May at 08:51

Combine multiple results in a subquery into a single comma-separated value

Combine multiple results in a subquery into a single comma-separated value I've got two tables: The relationship is one row of `TableA` - many of `TableB`. Now, I want to see a result like this: ``` I...

15 Mar at 08:11

How to perform Join between multiple tables in LINQ lambda

How to perform Join between multiple tables in LINQ lambda I am trying to perform a in LINQ. I have the following classes: And I use the following code (where `product`, `category` and `productcategor...

15 Mar at 13:0

Inner Join with derived table using sub query

Inner Join with derived table using sub query Environment: I created a derived table using sub query and joined with main table. I just like to know if subquery is executed only once or will it be exe...

SQL Update from One Table to Another Based on a ID Match

SQL Update from One Table to Another Based on a ID Match I have a database with `account numbers` and `card numbers`. I match these to a file to `update` any card numbers to the account number so that...

23 May at 16:50

LINQ to SQL: Multiple joins ON multiple Columns. Is this possible?

LINQ to SQL: Multiple joins ON multiple Columns. Is this possible? A table named `TABLE_1` with the following columns: - `ID`- `ColumnA`- `ColumnB`- `ColumnC` I have SQL query where `TABLE_1` joins on...

How do you left join in Linq if there is more than one field in the join?

How do you left join in Linq if there is more than one field in the join? I asked a question earlier about [why left joins in Linq can't use defined relationships](https://stackoverflow.com/questions/...

23 May at 12:1

How can I join multiple SQL tables using the IDs?

How can I join multiple SQL tables using the IDs? I have 4 different tables that I want to join. The tables are structured with columns as follows: Starting with Table A, I understand how to JOIN tabl...

14 Apr at 20:25

Is there some sort of syntax error with this LINQ JOIN?

Is there some sort of syntax error with this LINQ JOIN? I've looked at [various questions](https://stackoverflow.com/questions/3217669/how-to-do-a-join-in-linq-to-sql-with-method-syntax) on SO and [ot...

23 May at 12:25

LINQ join two DataTables

LINQ join two DataTables Hi I have a problem joining two DataTables using LINQ. Tables have columns like this: I used linq to join like this: ``` DataTable dtResult = new DataTable(); dtResult.Columns...

22 Jan at 10:14

Merging dataframes on index with pandas

Merging dataframes on index with pandas I have two dataframes and each one has two index columns. I would like to merge them. For example, the first dataframe is the following: The second dataframe is...

15 Feb at 06:40

using where and inner join in mysql

using where and inner join in mysql I have three tables. Here the table locations contains al

8 Sep at 07:33

How do I just LINQ Join() to link two IQueryables?

How do I just LINQ Join() to link two IQueryables? I have two IQueryables: I already have an IQueryable for Ingredient: How can I add a join to his so it filters by `AvailableIngredient` (i.e. an Inne...

Can't get c# linq query to compile with joins

Can't get c# linq query to compile with joins Below is a cut down example of some c# code I can't get to compile while doing some linq joins. Does anyone know why this doesn't compile? The error is > ...

30 Mar at 15:34

LINQ Join with Multiple Conditions in On Clause

LINQ Join with Multiple Conditions in On Clause I'm trying to implement a query in LINQ that uses a left outer join with multiple conditions in the ON clause. I'll use the example of the following two...

27 Jan at 10:2

Join between in memory collection and EntityFramework

Join between in memory collection and EntityFramework Is there any mechanism for doing a JOIN between an in-memory collection and entity framework while preserving the order. What I am trying is which...

ServiceStack Ormlite - Joins on child classes

ServiceStack Ormlite - Joins on child classes I'm using the latest ServiceStack Ormlite (v4.0.23), which provides new join support for joining on multiple columns. My entities all inherit from a BaseE...

The type of one of the expressions in the join clause is incorrect in Entity Framework

The type of one of the expressions in the join clause is incorrect in Entity Framework While trying to execute this query: ``` var query = from dpr in ctx.DPR_MM join q in ctx.QOT on dpr.DPR_QOT...

What's the best way to join on the same table twice?

What's the best way to join on the same table twice? This is a little complicated, but I have 2 tables. Let's say the structure is something like this: The tables can be joined based on Table1.PhoneNu...

24 Nov at 15:11

How to do join on multiple criteria, returning all combinations of both criteria?

How to do join on multiple criteria, returning all combinations of both criteria? I am willing to bet that this is a really simple answer as I am a noob to SQL. Given: - - There can be anywhere from 1...

2 Nov at 00:46

Pandas Merging 101

Pandas Merging 101 - `INNER``LEFT``RIGHT``FULL``OUTER``JOIN`- - - - - - `merge``join``concat``update` ... and more. I've seen these recurring questions asking about various facets of the pandas merge ...

31 Jul at 17:38

LINQ to SQL - Left Outer Join with multiple join conditions

LINQ to SQL - Left Outer Join with multiple join conditions I have the following SQL, which I am trying to translate to LINQ: I have seen the typical implementation of the left outer join (ie. `into x...

17 Sep at 15:10

MySQL: How do I join same table multiple times?

MySQL: How do I join same table multiple times? I have two tables `ticket` and `attr`. Table `ticket` has `ticked_id` field and several other fields. Table `attr` has 3 fields: `attr_type` is a fixed ...

24 Sep at 08:56

JPA Criteria API - How to add JOIN clause (as general sentence as possible)

JPA Criteria API - How to add JOIN clause (as general sentence as possible) I am trying to construct queries dynamically, and my next target is add JOIN clauses (I don't know how can I use the API). B...

9 Oct at 16:46

MySQL complex query not yielding proper results

MySQL complex query not yielding proper results I have two table: Vehicles(Id, VIN) and Images(Id, VehicleId, Name, Default). I need to select the vehicles VIN and its default picture to display in a ...

13 Aug at 19:43

Why is this Cross Join so Slow in Linq?

Why is this Cross Join so Slow in Linq? I wrote this piece of Linq to handle doing a CROSS Join just like a database would between multiple lists. But for some reason it's extremely slow when any of t...

14 Mar at 13:13

Entity Framework include with left join is this possible?

Entity Framework include with left join is this possible? I have the following tables 1. ClassRoom (ClassID,ClassName) 2. StudentClass (StudentID,ClassID) 3. Student (StudentID,StudentName,Etc..) 4. S...

27 Aug at 20:40

SQL Four Tables One Recordset

SQL Four Tables One Recordset What am I missing? I need to return all records that match the Last_Name Query whether they do or do not have a Customer Number in the Field_Table. I am calling the Clien...

27 Jul at 18:20

LINQ Inner-Join vs Left-Join

LINQ Inner-Join vs Left-Join Using extension syntax I'm trying to create a left-join using LINQ on two lists that I have. The following is from the Microsoft help but I've modified it to show that the...

8 Feb at 05:21

How to do joins in LINQ on multiple fields in single join

How to do joins in LINQ on multiple fields in single join I need to do a LINQ2DataSet query that does a join on more than one field (as I have yet found a suitable solution (I can add the extra constr...

23 May at 12:10

Nice, clean cross join in Linq using only extension methods

Nice, clean cross join in Linq using only extension methods > [Nested “from” LINQ query expressed with extension methods](https://stackoverflow.com/questions/9115675/nested-from-linq-query-expressed-...

23 May at 12:2

How to use join with multiple conditions in linq-to-Nhibernate

How to use join with multiple conditions in linq-to-Nhibernate I have two classes (Request & RequestDetail). I need to a `Linq To NHibernate`query between two classes by join. ``` var q = SessionInsta...

how do you search Right/Left joins?

how do you search Right/Left joins? I am having a problem searching multiple tables ,i have 2 tables tblcourse -courseid -name -status tblenroll -courseid(holds courseid from tblcourse) -studentid let...

7 Jun at 13:13

SQL Left Join first match only

SQL Left Join first match only I have a query against a large number of big tables (rows and columns) with a number of joins, however one of tables has some duplicate rows of data causing issues for m...

query specified join fetching, but the owner of the fetched association was not present in the select list

query specified join fetching, but the owner of the fetched association was not present in the select list I'm selecting two id columns but get error specified: ``` org.hibernate.QueryException: **que...

1 Sep at 19:27

Combine two pandas Data Frames (join on a common column)

Combine two pandas Data Frames (join on a common column) I have 2 dataframes: restaurant_ids_dataframe ``` Data columns (total 13 columns): business_id 4503 non-null values categories 4503 non-nu...

Include with FromSqlRaw and stored procedure in EF Core 3.1

Include with FromSqlRaw and stored procedure in EF Core 3.1 So here's the deal - I am currently using EF Core 3.1 and let's say I have an entity: When I access the `DbSet Entities` normal way, I inclu...

lambda expression join multiple tables with select and where clause

lambda expression join multiple tables with select and where clause I have three table many to many relationship I have joined the three table and select the value I want but now I need to select one ...

Create combined DataTable from two DataTables joined with LINQ. C#

Create combined DataTable from two DataTables joined with LINQ. C# I have the following code that fills `dataTable1` and `dataTable2` with two simple SQL queries, `dataTableSqlJoined` is filled from t...

4 Mar at 13:56

How to LeftJoin to the same table twice using ServiceStack OrmLite?

How to LeftJoin to the same table twice using ServiceStack OrmLite? I have table structures that look like below: I want to use OrmLite to generate SQL simil

SQL select join: is it possible to prefix all columns as 'prefix.*'?

SQL select join: is it possible to prefix all columns as 'prefix.*'? I'm wondering if this is possible in SQL. Say you have two tables A and B, and you do a select on table A and join on table B: If t...

30 Aug at 11:54

JPA eager fetch does not join

JPA eager fetch does not join What exactly does JPA's fetch strategy control? I can't detect any difference between eager and lazy. In both cases JPA/Hibernate does not automatically join many-to-one ...

21 Jan at 01:16

SQL Server: Multiple table joins with a WHERE clause

SQL Server: Multiple table joins with a WHERE clause I'm using SQL Server and I'm having a difficult time trying to get the results from a `SELECT` query that I want. I've tried joining in different o...

5 Nov at 22:9

Left Join without duplicate rows from left table

Left Join without duplicate rows from left table Please look at the following query: ``` Content_Id Content_Title Content_Text 10002 New case Study New case Study 10003 New case Study New case St...

31 Mar at 18:58

Retrieving data using LINQ

Retrieving data using LINQ I am stuck with this problem since few evenings. I have `SQLite` database in my application. I have created that SQLite DB from a file. The ERD diagram is shown below: ![ent...

29 Aug at 12:17

How to Left Outer Join two DataTables in c#?

How to Left Outer Join two DataTables in c#? How can I Left Outer Join two data tables with the following tables and conditions while keeping all columns from both tables? dtblLeft: dtblRight: ``` col...

2 Sep at 13:7

Getting inappropriate output with left join

Getting inappropriate output with left join I am trying to get list of variants and for each of this variants get all `subvariants list` irrespective of where subvariants fall for particular `Test say...

1 Aug at 18:57

Does "where" position in LINQ query matter when joining in-memory?

Does "where" position in LINQ query matter when joining in-memory? Say we are executing a LINQ query that joins two in-memory lists (so no DbSets or SQL-query generation involved) and this query also ...

18 Dec at 12:8