SQL query multiple tables

后端 未结 6 1149
予麋鹿
予麋鹿 2021-01-24 22:41

I have 2 tables and I need to select the relative information, need some help with the query.

Table 2 has ID, MaskID columns.

6条回答
  •  迷失自我
    2021-01-24 23:40

    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.

提交回复
热议问题