286 questions
0
votes
2
answers
327
views
SQL full outer join - when I want to exclude intersection part, why equal is used in join condition while values are never equal?
I have rows either in table t1 or in table t2. Both table have the common field id and name, and id is either null for t1 or t2(it cannot be in both table at the same time). Now I want to select all ...
0
votes
1
answer
82
views
SQL full outer join, default value to column in other table
I'm attempting to do a full outer join in Postgres to see how data changes between the past 24 hours and the 24 hours before that ("today" and "yesterday" euphemistically). Some ...
1
vote
1
answer
64
views
Snowflake SQL Compare Clone x Original Counts
I am trying to compare 2 tables (cloned table x original) using Full Outer Join on Snowflake but not getting the results I am expecting:
select
'invoice' as TABLE_NAME,
to_date(prd.date) as ...
-1
votes
1
answer
41
views
doing outer for really large data frame hitting memory usage in R
So i have three data frame having this information
> dim(result)
[1] 652265 10
> dim(rat)
[1] 107190 2
> dim(mouse)
[1] 219016 2
> names(result)
[1] "ensembl_gene_id&...
0
votes
2
answers
510
views
Can I avoid COALESCE during FULL OUTER JOIN?
In queries where I compare data between 2 tables, I often use combination of COALESCE and FULL OUTER JOIN to display records available only in 1 of the tables.
Can this be done with less syntactical ...
0
votes
1
answer
369
views
SQL filter on conditions before full outer join
I am trying to create an sql query (postgresql) which does a full outer join between two tables. For demonstration purposes I will use two tables: movies and genre. Some movies do not have a genre ...
2
votes
2
answers
473
views
Alternative to doing FULL OUTER JOIN for multiple tables?
I needed to run the following on MySQL, but it doesn't allow FULL OUTER JOINs:
SELECT COALESCE(t0.date, t1.date, t2.date, t3.date) AS date,
COALESCE(t0.hits1, 0) AS hits0,
COALESCE(t1....
0
votes
1
answer
135
views
difference between natural full outer join and full outer join with a common columns using clause [duplicate]
What is the difference between natural full outer join and full outer join with a common columns using clause?
They are the same.
0
votes
4
answers
123
views
Count the number of elements in sets A&B, A&~B, ~A&B
Table A is a list of IDs.
ID
---
1
5
9
...
Table B has IDs and another Y/N value.
ID Value
----------
1 0
2 1
3 0
...
I'd the count of Value for IDs that are:
i) both in tables A &...
0
votes
1
answer
129
views
FULL OUTER JOIN emulation and aggregate function (e.g. SUM)
I have two SQLite tables:
CREATE TABLE T_A (year_A INT, amount_A DOUBLE);
year_A | amount_A
----------------------
2020 | 100.0
2020 | 200.0
2021 | 300.0
2021 | ...
0
votes
2
answers
57
views
Join or Union table with same Characteristics and different Measures
I would like to understand the easy/better way to join 2 tables with same characteristics and different measures as an example described below:
tab1
Col1
Col2
Measure1
1
1
10
1
2
5
tab2
Col1
Col2
...
-1
votes
2
answers
653
views
SQL - How to join 2 tables with combined SUM function ? (Incorrect results currently)
In SQL I'm trying to combine multiple tables and grab the SUM of expenses per person, and sort those by highest total expense first. I have 3 tables:
test1 (from grocery store #1)
test2 (from ...
1
vote
2
answers
183
views
How to JOIN on columns with same name?
I have tables T1 and T2. Both have columns ID, X and Y. In addition, T1 has another column Z and T2 has another column A. ID is primary key. X is calculated from ID (so if ID matches, also X matches). ...
0
votes
1
answer
84
views
How to get full outer join in TimesTen [duplicate]
How do I get full outer join in TimesTen DB?
I tried this:
select t1.column1, t2.column2
from table1 t1
full outer join table2 t2 on t1.column1 = t2.column2;
This works in Oracle but when I run it ...
0
votes
1
answer
646
views
How to do a complex conditional outer join on pandas DataFrames using pandasql
This is a problem that took me a long time to solve, and I wanted to share my solution. Here's the problem.
We have 2 pandas DataFrames that need to be outer joined on a very complex condition. Here ...
0
votes
1
answer
175
views
SQL return results only if all rows match in join
I have the following tables
table name column names
----------- ------------------------
delivery_ service svc_name | svc_cost
product prod_id
...
0
votes
0
answers
232
views
How to Display Two Query Side by Side using SQL
I have the following 2 queries that are almost identical except the second query contains a table join, where clause and has less FAXDEPTs(the commented out portion is included in Query 2 just shared ...
-1
votes
1
answer
114
views
Generate Result based on max count in secondary column after a join
I have two tables which have a common key between them, and quite a lot of other important infos ; for the sake of simplicity i will be using Combination A and Combination B. When a combination is met,...
1
vote
2
answers
389
views
Union of two tables with information of the origin of each row
suppose I have two tables A and B, both with only 1 column name. Some rows appear in both tables while some are exclusive to one table. I want to union these two tables together into a table C that ...
1
vote
2
answers
322
views
EF select many doesn't retrieve record which has no relation
I have two tables, for example, Student and Grade.
Those two tables have a relationship with many-to-many, so the table is StudentGrade.
By using the .SelectMany query, I can retrieve all records ...
0
votes
1
answer
350
views
How perform natural full outer join in table having multiple attributes common?
mysql> select * from r;
+------+------+------+
| A | B | C |
| 1 | 2 | 3 |
| 1 | 2 | 4 |
| 2 | 1 | 3 |
| 3 | 1 | 3 |
+------+------+------+
mysql> ...
-2
votes
1
answer
54
views
Query regarding Full outer join
I have two tables and joining them using full outer join.
Tab1:
Crossswalk
Ind
name
123
Y
abc
Tab2:
Crosswalk
Ind
name
123
Null
abc
123
Null
bcd
select coalesce(a.crosswalk,b.crosswalk), a.Ind, ...
-2
votes
2
answers
186
views
Is there a where or group by for after a full outer joint to show the negative? [closed]
I’m trying to query a DB sql oracle which combines 2 tables data but shows the locations which have not had any orders.
I have created a location_t with the relevant grids by Mile from the main ...
0
votes
2
answers
66
views
How to union a data set with a specific rule
I have two almost identical data sets that I am trying to union but I only want to union them if there isn't a date in File 1 for it already.
Data Set 1
File
Date
Type
1
1/1/2020
a
1
1/2/2020
b
1
1/3/...
0
votes
2
answers
486
views
FULL OUTER JOIN with union subqueries
I am trying to create an output with a similar behaviour to FULL OUTER JOIN, with UNION in mysql
The queires I am trying to combine are the same with different time frame parameteres
EXAMPLE:
Select * ...