sql >> Database >  >> RDS >> Mysql

Fout #1066 - Geen unieke tabel/alias in MySQL

gebruik verschillende aliassen voor de tabel students en alle gerelateerde kolommen

select <Fields to be seleced>
FROM `batches`   
INNER JOIN courses ON courses.id = batches.course_id 
LEFT OUTER JOIN attendances ON attendances.batch_id = batches.id AND attendances.month_date = '2016-09-05'  
LEFT OUTER JOIN students st1 ON st1.id = attendances.student_id AND students.batch_id = batches.id 
INNER JOIN students st2 ON  batches.id = st2.batch_id 
WHERE ('2016-09-05' BETWEEN batches.start_date AND batches.end_date AND batches.is_active = 1 AND batches.is_deleted = 0 AND courses.is_deleted = 0 )  GROUP BY batches.id ORDER BY courses.course_name,batches.id LIMIT 0, 10;


  1. gem install pg error:kon kern.osversion `14.0.0' op Yosemite w/ Ruby 2.1.5 niet begrijpen

  2. Hoe het aantal rijen op te halen in PHP in Mysql Database?

  3. Hoe alleen de datumwaarde uit het datumveld in Oracle te extraheren?

  4. Django instellen om MySQL te gebruiken