3.7.2.顯示孿生對狀態的表
3.7.2. 顯示孿生對狀態的表
每一次會面以一個稱為event的狀態碼結束。下面顯示的查詢被用來顯示按事件組合的所有孿生的表。這表明多少對孿生已經完成,多少對的其中之一已完成而另一個拒絕了,等等。
SELECT
t1.event,
t2.event,
COUNT(*)
FROM
lentus AS t1,
lentus AS t2,
twin_project AS tp
WHERE
/* We are looking at one pair at a time */
t1.id = tp.id
AND t1.tvab=tp.tvab
AND t1.id = t2.id
/* Just the screening survey */
AND tp.survey_no = 5
/* This makes each pair only appear once */
AND t1.tvab='1' AND t2.tvab='2'
GROUP BY
t1.event, t2.event;