私はBIRTにレポートを書いています。私は自分のデータセットに2つの入力パラメータを持っています。パラメータを複数回再利用
句に2度使用したい2番目のパラメータです。私はと句を使って私がこれを行うのがわかった。これはpostgresqlデータベースなので、私はデュアルから必要はありません。
次のように私のSQLは次のとおりです。
with "params" as (select ? as "sname", ? as "ename")
select "user"."fullName", "user"."address1", "user"."address2", "user"."city", "provinces"."abbreviation", "user"."postalcode", "client"."companyName"
from "user", "params"
LEFT JOIN "client" on "user"."client" = "client"."id"
LEFT JOIN "provinces" on "user"."province" = "provinces"."id"
WHERE "user"."fullName" >= "params"."sname" and (("user"."fullName" <= "params"."ename") or ("params"."ename" =''))`
私はこれを実行するか、BIRTの編集データセット画面で結果をプレビューしようとすると、私は次のエラーを取得する:
Error happened while running the report. at .... Caused by: org.eclipse.birt.report.data.adapter.api.AdapterException: An exception occurred during processing. Please see the following message for details: Failed to prepare the query execution for the data set: user Cannot get the result set metadata. org.eclipse.birt.report.data.oda.jdbc.JDBCException: SQL statement does not return a ResultSet object. SQL error #1:ERROR: invalid reference to FROM-clause entry for table "user" Hint: There is an entry for table "user", but it cannot be referenced from this part of the query. Position: 252;
私はできませんこれでやってください。私が見たすべてから、それはうまくいくはずです。
関連のない、しかし: 'のparamsと(SNAME、ENAME)のように:あなたも短いCTEを行うことができます(値(?、?))... ' –
[テーブルのエントリがありますが、クエリのこの部分からは参照できません]との[明示的な結合と暗黙的な結合の混在] //stackoverflow.com/questions/6347897/mixing-explicit-and-implicit-joins-fails-with-there-is-anentent-for-table-b) –