一个mysql查询,为输出提供6个重复值而不是1

时间:2013-02-25 08:55:27

标签: mysql unique

我无法从查询中获取唯一结果。此处提到的查询显示重复值6次,而不是给出唯一的答案。我怎样才能得到一次结果?

SELECT step1 . * , TIME_FORMAT( step2.insert_time,  '%H:%i:%s' ) AS insert_time, 
 DATE_FORMAT( step2.insert_time, '%d-%b-%Y %h:%i:%s' ) tradate, b.batch_name, 
 a.student_rollno, a.student_name, sf.bif_code, sb.subject_name, s.stream_code, 
 c.class_code, dv.division_code, 
 CONCAT( faculty_fname,  ' ', faculty_lname ) facultyname
FROM csm_batch b, csm_step1 step1
INNER JOIN csm_class c ON c.class_code = ClassID
LEFT JOIN csm_stream s ON s.stream_code = StreamID
LEFT JOIN csm_subject sb ON sb.subject_code = SubjectID
LEFT JOIN csm_subject_bif sf ON sf.bif_code = BifID
LEFT JOIN csm_division dv ON dv.division_code = DivID
LEFT JOIN csm_faculty ad ON ad.faculty_id = FacultyID
INNER JOIN csm_step2 step2 ON step2.SessionID = step1.SessionID
LEFT JOIN csm_student a ON a.student_nfc_code = step2.StudentID
WHERE 0 =0
AND step2.SessionID =  '17f32204f8fe4c'
LIMIT 0 , 30

0 个答案:

没有答案