简体   繁体   中英

Sql query join two tables

I have 2 tables in my bd how can i do a query that joins the values of this 2 tables where id of table A is equal to Id_TABa:

Table A:

id

nome

correio

Table B:

Id_TABa

id

nome

SELECT * FROM tablea INNER JOIN tableb ON (tablea.id = tableb.Id_TABa);

There are several options :

SELECT *
FROM tableA
INNER JOIN tableB
    ON tableA.id = tableB.id_TABa;

OR

SELECT *
FROM tableA, tableB
WHERE tableA.id = tableB.id_TABa;

The first one is faster (as far as i remember)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM