SELECT * FROM TEST WHEER SUBID=(SELECT MAX(SUBID) FROM TEST) OR SUBID=(SELECT MIN9SUBID) FROM TEST)
select maxid,minid from test where subid=(select max(subid) from test) or subid=(s elect min(subid) from test); 呵呵,试试看
不好意思些错拉 select * from test where subid=(select max(subid) from test) or subid=(s elect min(subid) from test);
subId不在不同type组里面,范围可能不一样啊 有这种可能 id subId type ---------------------------- 1 0 1 4 2 1 5 0 2 6 1 2 7 3 2 8 5 2 ------------------------------- 你们的查询结果就是 id subId type ---------------------------- 1 0 1 5 0 2 8 5 2---------------------------- 希望结果是 id subId type ---------------------------- 1 0 1 4 2 1 5 0 2 8 5 2
好像这样可以 select * from test where (subid,type) in (select min(subid),type from test group by type) or (subid,type) in (select max(subid),type from test group by type)
WHEER SUBID=(SELECT MAX(SUBID) FROM TEST)
OR SUBID=(SELECT MIN9SUBID) FROM TEST)
elect min(subid) from test);
呵呵,试试看
select * from test where subid=(select max(subid) from test) or subid=(s
elect min(subid) from test);
有这种可能
id subId type
----------------------------
1 0 1
4 2 1
5 0 2
6 1 2
7 3 2
8 5 2
-------------------------------
你们的查询结果就是
id subId type
----------------------------
1 0 1
5 0 2
8 5 2----------------------------
希望结果是
id subId type
----------------------------
1 0 1
4 2 1
5 0 2
8 5 2
select * from test
where (subid,type) in (select min(subid),type from test group by type)
or
(subid,type) in (select max(subid),type from test group by type)
不知道有没有高效的sql