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

时间:2022-08-12 05:33:26

I have two tables.

我有两张桌子。

table A
id
isReachEnd

table B
id
isFree

I need to fetch all id's which satisfy next criterion:

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

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

How can I do?

我能怎么做?

2 个解决方案

#1


1  

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

#2


2  

This is not complex at all -- it's very simple, in fact. The query would be just be

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

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

#2


2  

This is not complex at all -- it's very simple, in fact. The query would be just be

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

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