TB1 knows the marriage between <.name> and <id#>
TB2 knows the marriage between <id#> and <desk#>
I need either table to absorb the other. There are many many many other variables on these tables but specifically I am needing the ability to export a CSV where all 3 of the above values are married together.
I did another query and ended up having all 3 on the same table, but the marriages were lost so I had for example <.name1><.id1><.desk300>
I’m sure this is a simple concept but everywhere I’m looking its just talking about importing columns with no regard to the previous data.
once they are married I can just do a “select * blah blah desk# between 300 and 400” and get a list of names etc.
Any help is welcome. Feel free to just send me to a w3 learning document if it exists. But I looked haha!
Better yet actually a SQL query that pulls data from both would work best. That way data doesn’t have to be updated every time it changes in one to change in the other.
the syntax which uses USING is fairly limited, in that you can use it only if the tables are to be joined on a column which has the same name in both tables
the more general form, which you should adopt, is
SELECT
FROM table1
[ INNER | LEFT | RIGHT | FULL [ CROSS ] JOIN table2
[ON table2.somecolumn = table1.someothercolumn] *
* ON clause not applicable to CROSS joins
as for the original syntax, in which the tables are mentioned in a comma-delimited list in the FROM clause, with the join condition(s) in the WHERE clause, the deficits are
it works only for inner and cross joins
when there are multiple tables it’s ~so~ easy to mess up your join conditions and not catch it