インタビューが終わると、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 sceening 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;
This is a translation of the MySQL Reference Manual that can be found at dev.mysql.com. The original Reference Manual is in English, and this translation is not necessarily as up to date as the English version.
