tagged [join]
how to use a like with a join in sql?
how to use a like with a join in sql? I have 2 tables, say table A and table B and I want to perform a join, but the matching condition has to be where a column from A 'is like' a column from B meanin...
Inner Join: Is this an optimal solution?
Inner Join: Is this an optimal solution? T1: employee [id, salary] T2: department [name, employeeid] (employeeid is a foreign key to T1's id) Problem: Write a query to fetch the name of the department...
- Modified
- 11 Dec at 19:46
SQL join on multiple columns in same tables
SQL join on multiple columns in same tables I have 2 subqueries, but I'm having trouble joining columns together from the same tables. I tried: ``` SELECT * FROM (SELECT userid, listid FROM user_views...
Pandas join issue: columns overlap but no suffix specified
Pandas join issue: columns overlap but no suffix specified I have the following data frames: When I try to join these data frames: ``` j
Need help joining table
Need help joining table I have a function that exports a table to CSV and in the query I set which fields will export. Here is the query: The field venue_id is the the id of the venue which is referre...
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...
- Modified
- 27 Feb at 14:49
Join two sql queries
Join two sql queries I have two SQL queries, where the first one is: and the second one is: ``` select Activity, SUM(Amount) as "Total Amount 2008" from Activities, Incomes2008 where Activi
Left Join With Where Clause
Left Join With Where Clause I need to retrieve all default settings from the settings table but also grab the character setting if exists for x character. But this query is only retrieving those setti...
- Modified
- 20 Jan at 20:59
SQL Joins Vs SQL Subqueries (Performance)?
SQL Joins Vs SQL Subqueries (Performance)? I wish to know if I have a query something like this - and a something like this - When I consider which of the two queries would be faster and ? Also is the...
- Modified
- 29 Nov at 04:37
Linq join without equals
Linq join without equals I have a list of rectangles and a list of points. I want to construct a LINQ query that will match the list of points with their corresponding rectangles. Something like this:...
Select rows which are not present in other table
Select rows which are not present in other table I've got two postgresql tables: I want to get every IP address from `login_log` which doesn't have a row in `ip_location`. I tried this query but it t...
- Modified
- 4 Jan at 16:59
How to specify names of columns for x and y when joining in dplyr?
How to specify names of columns for x and y when joining in dplyr? I have two data frames that I want to join using dplyr. One is a data frame containing first names. ``` test_data
SQL join: selecting the last records in a one-to-many relationship
SQL join: selecting the last records in a one-to-many relationship Suppose I have a table of customers and a table of purchases. Each purchase belongs to one customer. I want to get a list of all cust...
- Modified
- 14 Dec at 17:47
LEFT OUTER JOIN in LINQ
LEFT OUTER JOIN in LINQ How to perform left outer join in C# LINQ to objects without using `join-on-equals-into` clauses? Is there any way to do that with `where` clause? Correct problem: For inner jo...
vlookup in Pandas using join
vlookup in Pandas using join I have the following 2 dataframes I want to perform a merge, or join opertation using Pandas (or whichever Python operator is best) to produce the below data frame. ``` Ex...
How to join 3 tables with lambda expression?
How to join 3 tables with lambda expression? I have a simple LINQ lambda join query but I want to add a 3rd join with a where clause. How do I go about doing that? Here's my single join query: ``` var...
T-SQL: Selecting rows to delete via joins
T-SQL: Selecting rows to delete via joins Scenario: Let's say I have two tables, TableA and TableB. TableB's primary key is a single column (BId), and is a foreign key column in TableA. In my situatio...
LINQ: combining join and group by
LINQ: combining join and group by I have a query that combines a join and a group, but I have a problem. The query is like: ``` var result = from p in Products join bp in BaseProducts on ...
- Modified
- 30 Sep at 12:43
SQL JOIN, GROUP BY on three tables to get totals
SQL JOIN, GROUP BY on three tables to get totals I've inherited the following DB design. Tables are: My query needs to return invoiceid, the invoice amount (in the invoices ta
SQL Query with Join, Count and Where
SQL Query with Join, Count and Where I have 2 tables and am trying to do one query to save myself some work. I want to join them so that I get `id, category id, category name, colour` Then I want to l...
- Modified
- 19 Jul at 16:49
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...
- Modified
- 31 Mar at 12:43
Unable to create a constant value of type Only primitive types or enumeration types are supported in this context
Unable to create a constant value of type Only primitive types or enumeration types are supported in this context I am getting this error for the query below > Unable to create a constant value of typ...
- Modified
- 13 Oct at 11:10
ServiceStack OrmLite LeftJoin Issue
ServiceStack OrmLite LeftJoin Issue I'm using ServiceStack OrmLite JoinSQLBuilder with a left join and have found an issue. Suppose I have 2 tables, TableA and TableB and wanted to join on more than a...
- Modified
- 23 May at 12:20
SQL query: Simulating an "AND" over several rows instead of sub-querying
SQL query: Simulating an "AND" over several rows instead of sub-querying Suppose I have a "tags" table with two columns: and . Each row represents a tag assigned to a piece of content. I want a query ...