我得到了table1
和table2
,並且需要從每個表中獲取數據。從兩個不同的表中選擇數據而不使用連接
表1
"id" "name" "description"
"1" "Windows" "Microsoft Windows 8"
表2
"id" "type" "name" "description"
"1" "22" "Microsoft Windows" "Microsoft Windows 8 Home"
"2" "2" "Not an Edit" "Not an Edit"
我做選擇這樣
select table1.name, table1.description,
table2.name, table2.description
from table1,table2
where table2.id=table1.id and table2.`type`=22;
使用將內連接變得更快或更有效地選擇一些時500+一次行嗎?
我見過大多數使用內部連接的例子來做到這一點。
和問題是什麼?的 – Aguardientico
可能重複[ANSI與非ANSI SQL JOIN語法(http://stackoverflow.com/questions/1599050/ansi-vs-non-ansi-sql-join-syntax) –
我不知道你在哪裏正在尋找像這樣的內部連接的例子。只需使用一個明確的'INNER JOIN' – Scotch