문제

I'm trying to replace a comment in my sql query using a javascript. My sql query goes something like this.

    select round(sum(case when date_part('month', fd.fs_dt) = 1 and date_part('year', fd.fs_dt) = /**year**/ then amount end)::numeric, 0) January_data
from this_table

My javascript query goes something like this.

if (params["This_year"] == "1/1/14"){
this.querytext = this.queryText.replace("/**year**/", "2014")}
else if (params["This_year"] == "1/1/15"){
this.querytext = this.queryText.replace("/**year**/", "2015")}

It's giving me an error at or near 'then'

도움이 되었습니까?

해결책

The code doesn't actually replace anything since you assign the result of the replacement to a new variable (querytext instead of queryText).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top