SELECT DISTINCT *
FROM `ilmentyma`
LEFT JOIN `lekseemi`
ON (
    `ilmentyma`.lekseemi_id = `lekseemi`.id
)
LEFT JOIN `merkitys`
ON (
    `lekseemi`.id = `merkitys`.lekseemi_id
)
WHERE (
    `ilmentyma`.ortognro = 3
AND `merkitys`.ortognro = 1
AND `ilmentyma`.varmennettu = 1
AND `merkitys`.varmennettu = 1
AND `ilmentyma`.aakk != "True"
) 
ORDER BY `ilmentyma`.ilmentyma ;



