I have 2 tables and I need to select the relative information, need some help with the query.
Table 2 has ID
, MaskID
columns.
SELECT a.ID, b.MaskName, b.Total from 2 a INNER JOIN 3 b ON a.MaskID=b.MaskID WHERE ID='Given value'
This is a simple MySQl/T SQL/ PLSQL query. Just use an INNER JOIN on the two tables. A Join works by combining the two tables side by side. The INNER JOIN only outputs the result of the intersection of the two tables. That is, only those rows where the primary key and foreign key have a matching value.
In certain cases, you may want other rows outputted as well, for such cases look up LEFT JOIN, RIGHT JOIN and FULL JOIN.