iReportのレポートクエリウィザードに以下のクエリがあります
select docid_fname_pemid.*, MONTHNAME(b.ServicePeriodDate) as month_name,YEAR(b.ServicePeriodDate) as year_name , b.NonLTCMaximumSpecialPayment, b.NonLTCEnrolledPatientOutsideUseTotal, b.NonLTCAccessBonus
from (
select docid_pemid.PEMID, docid_pemid.DoctorID, b.$P{transparency_check})
from (
select DoctorID,PEMID from DoctorPEMMap where PEMID in ($P{PEMID_input}) and StartDate >= $P{StartDate} and (EndDate <= $P{EndDate} or EndDate <= '0000-00-00') group by PEMID order by PEMID
)docid_pemid left join Doctors b on docid_pemid.DoctorID=b.DoctorID
) docid_fname_pemid
left join DoctorPayments b on docid_fname_pemid.DoctorID=b.DoctorID
&パラメータ、順番に(パラメータクラス、プロンプトYes/NO、デフォルト値式)
1) PEMID_input
--> 文字列、プロンプト はい、いいえ
2) month_year
--> .String,prompt はい、いいえ
3) transparency_input
--> 文字列、プロンプト はい、いいえ
4) transparency_check
-->文字列、プロンプトなし、($P{transparency_input}=="yes" ) ? ("FirstName") : ("AliasFirstName")
5) StartDate
-->文字列、プロンプトなし、$P{month_year}.split("-")[0]=="April" ? $P{month_year}.split("-")[1].concat("-04-01") : $P{month_year}.split("-")[1].concat("-10-01")
6) EndDate
-->文字列、プロンプトなし、$P{month_year}.split("-")[0]=="April" ? $P{month_year}.split("-")[1].concat("-09-30") : $P{month_year}.split("-")[1].concat("-03-31")
レポートを実行すると、以下のエラーが表示されます
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the right syntax to use near ''FirstName'
from ( select DoctorID,PEMID from DoctorPEMMap where PEMID in ('21' at line 3
で
クエリが取得されていないと思います'b.FirstName'
。そのため、 concat 関数を として使用しましconcat('b.',$P{transparency_check})
たが、機能しません。
私は最終的にb.FirstName
、またはb.AliasFirstName
mysqlクエリのように、手動でこの用語のいずれかを指定すると、クエリは正常に実行されます。
どうやって行けばいいですか?