質問

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