It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center。
7年前关闭。
退货:100102110
返回:102112118
返回:101102120
我需要一个组合以上内容并返回公共数据的查询:102。
7年前关闭。
SELECT STATNO FROM ENQUIRY WHERE ID=12;
退货:100102110
SELECT STATNO FROM ENQUIRY WHERE ID=16;
返回:102112118
SELECT STATNO FROM ENQUIRY WHERE ID=21;
返回:101102120
我需要一个组合以上内容并返回公共数据的查询:102。
最佳答案
drop table if exists enquiry;
create table enquiry (id integer, statno integer);
insert into enquiry values
(12,100),(12,102),(12,110),
(18,102),(18,112),(18,118),
(21,101),(21,102),(21,120);
select distinct statno from enquiry where
statno in (select statno from enquiry where id=12)
and statno in (select statno from enquiry where id=18)
and statno in (select statno from enquiry where id=21)
;
关于mysql - 通过组合三个不同的sql查询的数据来获取公共(public)数据,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/10380995/
10-10 12:27