行IDが最初のテーブルと等しい2番目のテーブルからデータを取得したいのですが、構文やコードを教えてくれる人はいますか?
2 に答える
2
それを行うには多くの異なる方法があります。
あなたが使用することができますjoin
:
Select t2.*
from tab2 t2
join tab1 t1 on t1.id = t2.id
in
また、演算子を使用することができます
Select *
from tab2 t2
where t2.id in ( select t1.id
from table1 t1
)
exists
または、演算子を使用できます
Select *
from tab2 t2
where exists
(
selec 1
from table1 t1
where t2.id = t1.id
)
于 2012-09-26T09:58:15.753 に答える
0
あなたの質問はでタグ付けされてiPhone
IOS
いるので、これはクエリ文字列である可能性があります
NSString *query = [NSString stringWithFormat:@"SELECT * FROM secondTable WHERE rowid = %d",yourRowID];
//where yourRowID is your first table id
Database
ただし、構文について話している場合は、このリンクテーブルの結合を参照してください。
于 2012-09-26T09:59:07.343 に答える