我正在使用以下查询来获取最近的地方。但是如果我将where条件无效,那么错误就会出现。
<audio id='myAudio'controls>
<source id='mySource' src="song.mp3" type="audio/mpeg"/>
</audio>
$('#myAudio').on('ended', function() {
$("#mySource").attr("src", Your_New_sourcel);
var audio = $("#myAudio");
audio[0].pause();
audio[0].load();
audio[0].play();
});
如果我添加where条件错误来了。请帮我如何为上述查询添加条件。
答案 0 :(得分:0)
尝试使用HAVING
条件替换WHERE
子句:
SELECT attName, description, rating,
COMMENT , latitude, langtitude, openingTime, closingTime,(
(
ACOS( SIN( ".$lat." * PI( ) /180 ) * SIN( latitude * PI( ) /180 ) + COS( ".$lat." * PI( ) /180 ) * COS( latitude * PI( ) /180 ) * COS( (
".$lang." - langtitude
) * PI( ) /180 ) ) *180 / PI( )
) *60 * 1.1515
) AS distance
FROM attraction
WHERE distance < 31
ORDER BY distance
然后将添加条件添加为AND this = that
HAVING
子句通常与GROUP BY
一起使用 - 您没有。
SELECT ... FROM ... WHERE ... GROUP BY ... HAVING ... ORDER BY ...