SELECT * FROM satispersoneli sp left join shift s on s.Suid=sp.Sid where sp.Smagaza = 2 and (s.Shafta = 12 and s.Shafta is null) and sp.Saktifmi = 1