tagged [join]

Count with IF condition in MySQL query

Count with IF condition in MySQL query I have two tables, one is for news and the other one is for comments and I want to get the count of the comments whose status has been set as approved. ``` SELEC...

31 Mar at 12:43

How to join multiple collections with $lookup in mongodb

How to join multiple collections with $lookup in mongodb I want to join more than two collections in MongoDB using the aggregate `$lookup`. Is it possible to join? Give me some examples. Here I have t...

21 Feb at 20:53

Can we use join for two different database tables?

Can we use join for two different database tables? Can we use the join operation for two tables from different databases? If yes, how do I do it? Both databases are on the same server and DBMS is the ...

1 Feb at 09:9

How to return rows from left table not found in right table?

How to return rows from left table not found in right table? I have two tables with similar column names and I need to return records from the left table which are not found in the right table? I have...

18 Jan at 17:49

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...

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,

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

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 | ...

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

MySQL INNER JOIN select only one row from second table

MySQL INNER JOIN select only one row from second table I have a `users` table and a `payments` table, for each user, those of which have payments, may have multiple associated payments in the `payment...

27 Feb at 14:49

SQL JOIN and different types of JOINs

SQL JOIN and different types of JOINs What is a SQL `JOIN` and what are different types?

22 Feb at 13:58

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

Update statement with inner join on Oracle

Update statement with inner join on Oracle I have a query which works fine in MySQL, but when I run it on Oracle I get the following error: > SQL Error: ORA-00933: SQL command not properly ended 0093...

20 Nov at 09:39

Join vs. sub-query

Join vs. sub-query I am an old-school MySQL user and have always preferred `JOIN` over sub-query. But nowadays everyone uses sub-query, and I hate it; I don't know why. I lack the theoretical knowled...

3 Nov at 18:0

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

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....

Difference between natural join and inner join

Difference between natural join and inner join What is the difference between a natural join and an inner join?

1 Jul at 19:2

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...

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...

Join between tables in two different databases?

Join between tables in two different databases? In MySQL, I have two different databases -- let's call them and . Is it possible to perform a join between a table that is in database , to a table that...

2 Apr at 11:35

How to concatenate two collections by index in LINQ

How to concatenate two collections by index in LINQ What could be a LINQ equivalent to the following code? ``` string[] values = { "1", "hello", "true" }; Type[] types = { typeof(int), typeof(string)...

24 Jan at 10:27

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

Explicit vs implicit SQL joins

Explicit vs implicit SQL joins Is there any efficiency difference in an explicit vs implicit inner join? For example: vs.

26 Oct at 19:14

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

What is the syntax for an inner join in LINQ to SQL?

What is the syntax for an inner join in LINQ to SQL? I'm writing a LINQ to SQL statement, and I'm after the standard syntax for a normal inner join with an `ON` clause in C#. How do you represent the ...

21 Aug at 10:31