我很难从子查询中提取值。
假设我有以下表格:
D(fid, pid, r),
F(fid,t,j)
在第一次选择时,我需要来自下面子查询的 fj。
SELECT pid -- Here I need f.j to show up
FROM D
WHERE r='something' AND fid IN
(
SELECT f2.fid
FROM F f2,
(
SELECT f.j, COUNT(*) -- I need f.j above
FROM F f
GROUP BY f.j
HAVING COUNT(*) >=2
) f
WHERE f.j = f2.j
)
GROUP BY pid
HAVING COUNT(*) >= 2
谢谢。