This is my query. And I want all rows of BF and matched rows of FT. It returns only 2 rows but the real row count is 135. How should I change my query?
SELECT
BF.FaturaNo,
K.KlinikAdi,
FT.teslimAlindi,
FT.TeslimAciklama,
FT.kurumTeslimAldi,
FT.kurumTeslimAciklama,
BF.basilmisFatura_id,
K.klinik_id
FROM
BasilmisFaturalar AS BF
LEFT OUTER JOIN
FaturaTeslim AS FT
ON FT.refBasilmisFatura_id = BF.BasilmisFatura_id
INNER JOIN
Klinikler AS K
ON BF.refKlinik_id = K.klinik_id
INNER JOIN
Faturalar AS F
ON F.refBasilmisFatura_id = BF.basilmisFatura_id
WHERE
BF.FaturaNo LIKE '%%'
AND BF.refklinik_id IN ('24','25','26','27')
AND MONTH(F.faturaTarihi) = 7
AND teslimAlindi = 0
AND kurumTeslimAldi = 0
GROUP BY
F.refBasilmisFatura_id,
BF.FaturaNo,
K.KlinikAdi,
FT.teslimAlindi,
FT.TeslimAciklama,
FT.kurumTeslimAldi,
FT.kurumTeslimAciklama,
BF.basilmisFatura_id,
K.klinik_id
ORDER BY
faturaNo ASC