sql - Inner join on tables not directly related -
OK, I have three tables (these are definitely more relevant) with these fields:
< P> full_tableattribute
articleID
main_table
articleID
other_table
attribute
Therefore there is a complete list of "article ID" and its related "specialty" in the main_table. There are only some articles in the main_table. Other_Table contains only some of those "attributes".
What I want to do is to get articles which have specialty in other _table and whose article ID is in main_table.
EDIT: Visual help of some details
The problem is my query also gives them all those who are not in other_tables.
The query is as follows:
SELECT full_ table.attribute, main_table.articleID FROM main_table INNER full_ table on the full_ table .articleID = main_table.articleID INNER Other_tables in other_table on other_table. Attribute = full_table.attribute
EDIT2: I have tested the sample photo and code on sql bella and works as desired, so the problem comes from the additional complexity of the actual query, i I will research the source of this issue.
What I think. Enter the NIHARAR (100) NHARAR Attribute (ADB2), (2, 'Attrib 2'), (NIHARAR) (NIHARAR (100)). (2), (3), (5) (2), (2), (3), (5), (100)) NEHARA (AITAARA) 3, 'Atte 3', (4, 'Attrib 4'), (5, 'Attrib 5') @ _man_table values @ Insert in other worthable values ('Attribute 1'), ('Attrib2'), ('attrib5') SELECT a. * Join @ integer_ as an integer @ as a_table as a.attribute = b.attribute
Comments
Post a Comment