需要创建一个复杂的sql语句

时间:2012-05-25 15:53:00

标签: sql sqlite

我有两张桌子。

table A
id
isReachEnd

table B
id
isFree

我需要获取满足下一个标准的所有id:

((A.id = B.id) AND (A.isReachEnd = 1) AND (B.isFree = 1))

我该怎么办?

2 个答案:

答案 0 :(得分:2)

这根本不复杂 - 事实上它非常简单。查询将是

SELECT * FROM a, b WHERE a.id = b.id AND a.isReachEnd = 1 AND b.isFree = 1

答案 1 :(得分:1)

SELECT *
FROM A, B
WHERE A.id = B.id AND A.isReachEnd = 1 AND B.isFree = 1