我尝试过几种不同的方式重写此查询,但没有运气。非常感谢这里的帮助。
function createWaterBodyDropDown(region) {
var query = "SELECT 'LAKE_NAME' FROM 1IfQgRAeKPbVJwEpAnqqpYlN8sgiPMg1VQ_RyArI WHERE 'REGION'=" + '"' + region + '"';
var queryText = encodeURIComponent(query);
var gvizQuery = new google.visualization.Query(
'http://www.google.com/fusiontables/gvizdata?tq=' + queryText);
//Send query and draw table with data in response
gvizQuery.send(function (response) {
var str;
var numRows = response.getDataTable().getNumberOfRows();
var numCols = response.getDataTable().getNumberOfColumns();
var name = [
'<label style="font-weight:bolder;font-size:16px">Water body: </label>' + '<select id="waterbody_menu" style="font-size:16px;" onchange="select_waterBody(this.options[this.selectedIndex].value);">' + '<option value="">--All--</option>'
];
for (var i = 0; i < numRows; i++) {
var val = response.getDataTable().getValue(i, 0);
name.push("<option value=" + "'" + val + "'" + ">" + val + "</option>");
}
name.push('</select>');
document.getElementById('waterBody_container').innerHTML = name.join('');
});
}
答案 0 :(得分:0)
您的列名没有特殊字符,因此它们不需要引用,但它们可以是(带单引号)。必须使用单引号引用字符串值。有关详细信息,请参阅reference manual。
所以:
SELECT LAKE_NAME FROM 1IfQgRAeKPbVJwEpAnqqpYlN8sgiPMg1VQ_RyArI WHERE REGION = 'foobar'