如何在以下复杂的MySQL查询中删除空列

时间:2014-06-11 20:47:25

标签: php android mysql database null

我的MYSQL查询相当复杂,我想从中删除空列

SELECT NamazTiming.FajarZamat,MasjidMaster.MasjidID_PK,MasjidMaster.MasjidName,MasjidMaster.Longitude,MasjidMaster.Latitude,MasjidMaster.Address,
    SQRT( POW( 69.1 * (MasjidMaster.Latitude - 19.8) , 2 ) + POW( 69.1 * (75.4- MasjidMaster.Longitude) * COS(MasjidMaster.Latitude / 57.3 ) , 2 ) ) AS distance ,CityMaster.CityName
    FROM MasjidMaster
    LEFT JOIN CityMaster
    ON MasjidMaster.CityID_FK = CityMaster.CityID_PK
    LEFT JOIN NamazTiming 
    ON  MasjidMaster.MasjidID_PK = NamazTiming.MasjidID_FK 
    HAVING distance < 10
    ORDER BY NamazTiming.FajarZamat

Null列是NamazTiming.FajarZamat

1 个答案:

答案 0 :(得分:0)

我相信您应该在ORDER BY之前将以下内容添加到您的查询中。这将删除该列为null的所有行。

WHERE NamazTiming.FajarZamat IS NOT NULL