Каждый опрос оканчивается кодом
состояния, называющимся
event (``событие'').
Приведенный здесь запрос выводит
данные обо всех парах близнецов,
объединенные по полю 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.
© 1995-2005 MySQL AB. All rights reserved.
