getEnqueteResultMinMaxMemberIdBySql.sql 525 Bytes
Newer Older
Kim Gyeongeun committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
SELECT min(R.member_id) minId,max(R.member_id) maxId
    from t_reply R  

    INNER JOIN m_answer A  
    ON   R.enquete_id = A.enquete_id  
    AND  R.question_id = A.question_id  
    AND  A.DEL_FLG =0
    
    INNER JOIN m_question Q 
    ON   R.enquete_id = A.enquete_id  
    AND  R.question_id = A.question_id  
    AND  R.answer_id = A.answer_id 
    AND  R.question_no = Q.question_no 
    AND Q.DEL_FLG = 0 
    
WHERE Q.enquete_id = /*enquete_id*/ AND R.enquete_id = /*enquete_id*/ 
and R.member_id is not null