tagged [join]

Join/Where with LINQ and Lambda

Join/Where with LINQ and Lambda I'm having trouble with a query written in LINQ and Lambda. So far, I'm getting a lot of errors here's my code: ``` int id = 1; var query = database.Posts.Join(database...

29 Dec at 00:29

T-SQL: Inner join on a field with 2 values

T-SQL: Inner join on a field with 2 values I have this query on a MS SQL Server 2005: Label_Id is a field containing data like this: I have a custom split Function which returns from a string a table ...

3 Dec at 03:18

LINQ - Full Outer Join

LINQ - Full Outer Join I have a list of people's ID and their first name, and a list of people's ID and their surname. Some people don't have a first name and some don't have a surname; I'd like to do...

LEFT JOIN only first row

LEFT JOIN only first row I read many threads about getting only the first row of a left join, but, for some reason, this does not work for me. Here is my structure (simplified of course) ``` rel_id | ...

LINQ Joining in C# with multiple conditions

LINQ Joining in C# with multiple conditions I have a LINQ Joining statement in C# with multiple conditions. ``` var possibleSegments = from epl in eventPotentialLegs join sd in segmentDurations on...

14 Apr at 01:27

Use contains in LINQ to SQL join

Use contains in LINQ to SQL join How can I do a LINQ to SQL join without an exact match? For example, say I have a table `form` with the data `John Smith (2)` and I want to join it to the field `Smith...

2 Jul at 16:43

SQL LEFT-JOIN on 2 fields for MySQL

SQL LEFT-JOIN on 2 fields for MySQL I have a view `A` and a view `B`. In `A` I have a lot of information about some systems, like `IP` and `port` which I want to preserve all. In `B` I have just one i...

28 Nov at 18:49

CROSS JOIN vs INNER JOIN in SQL

CROSS JOIN vs INNER JOIN in SQL What is the difference between `CROSS JOIN` and `INNER JOIN`? ``` SELECT Movies.CustomerID, Movies.Movie, Customers.Age,

MySQL Query Join and Count Query

MySQL Query Join and Count Query I'm trying to pull values from a database for a web app where a moderator can add companies to a list of specified industries. This request needs to pull each industry...

7 Sep at 10:18

Removing extra commas from string after using String.Join to convert array to string (C#)

Removing extra commas from string after using String.Join to convert array to string (C#) I'm converting an array into a string using `String.Join`. A small issue I have is that, in the array some ind...

6 Jun at 19:58

WHERE conditions in subquery while using ANSI joins

WHERE conditions in subquery while using ANSI joins Why doesn't it work? I get "ORA-00900: invalid SQL statement". Is there a way to use WHERE clause inside the subquery? Edit: Version 9.2 Oracle9i En...

13 Nov at 23:22

MySQL JOIN with LIMIT 1 on joined table

MySQL JOIN with LIMIT 1 on joined table I want to join two tables, but only get 1 record of table2 per record on table1 For example: This would get me all records in `products`, which is not what I wa...

29 Jul at 21:49

Does the join order matter in SQL?

Does the join order matter in SQL? Disregarding performance, will I get the same result from query A and B below? How about C and D? ``` ----- Scenario 1: -- A (left join) select * from a left join b...

26 Nov at 08:29

FULL OUTER JOIN vs. FULL JOIN

FULL OUTER JOIN vs. FULL JOIN Just playing around with queries and examples to get a better understanding of joins. I'm noticing that in SQL Server 2008, the following two queries give the same result...

29 Sep at 21:47

Update Query with INNER JOIN between tables in 2 different databases on 1 server

Update Query with INNER JOIN between tables in 2 different databases on 1 server Need some SQL syntax help :-) Both databases are on the same server ``` db1 = DHE db2 = DHE_Import UPDATE DHE.dbo.tblAc...

27 Mar at 17:24

SQL: inner join on alias column

SQL: inner join on alias column Previously I have asked to strip text from a field and convert it to an int, this works successfully. But now, I would like to do an INNER JOIN on this new value. So I ...

14 Jul at 12:31

1052: Column 'id' in field list is ambiguous

1052: Column 'id' in field list is ambiguous I have 2 tables. `tbl_names` and `tbl_section` which has both the `id` field in them. How do I go about selecting the `id` field, because I always get this...

Appending two dataframes with same columns, different order

Appending two dataframes with same columns, different order I have two pandas dataframes. I simply want to join such that the final DF will look like: ``` click |

15 Oct at 14:10

How to join on multiple columns in Pyspark?

How to join on multiple columns in Pyspark? I am using Spark 1.3 and would like to join on multiple columns using python interface (SparkSQL) The following works: I first register them as temp tables....

SQL LEFT JOIN Subquery Alias

SQL LEFT JOIN Subquery Alias I'm running this SQL query: An

19 Dec at 15:30

How do I convert multiple inner joins in SQL to LINQ?

How do I convert multiple inner joins in SQL to LINQ? I've got the basics of LINQ-to-SQL down, but I've been struggling trying to get JOINs to work properly. I'd like to know how to convert the follow...

31 Mar at 23:37

pandas three-way joining multiple dataframes on columns

pandas three-way joining multiple dataframes on columns I have 3 CSV files. Each has the first column as the (string) names of people, while all the other columns in each dataframe are attributes of t...

10 Sep at 21:8

Hibernate Criteria Join with 3 Tables

Hibernate Criteria Join with 3 Tables I am looking for a hibernate criteria to get following: Dokument.class is mapped to Role roleId Role.class has a ContactPerson contactId Contact.class FirstName L...

21 Dec at 21:30

Subselect in a Join - Problem

Subselect in a Join - Problem I've a little Problem with a statement: ``` SELECT p1.Modell_nr, p1.ProductID, p2.count_modlieffarbe_vl, concat(p1.Modell_nr,'_',p1.LiefFarbe) as modfarb_id1 FRO...

28 Feb at 16:41

MySQL: Quick breakdown of the types of joins

MySQL: Quick breakdown of the types of joins I would like a quick breakdown of the types of MySQL joins. I know of these, the rest I am not sure what they mean. - `SELECT * FROM a, b WHERE b.id = a.be...

9 Jun at 14:49