これは簡単な質問だと思っていますが、Crystal Reportsはよく分かりません。 @beginning_dateと@ending_dateの宣言された日付フィールドを使用するSQLクエリを作成しました。実行するとCrystalがこれらのフィールドの入力を要求します。私は水晶のパラメータフィールドを追加して同じ名前を付けましたが、それらを同期させる方法は不明です。私のコードは以下の通りです。前もって感謝します。Crystal Reportパラメータが宣言されたSQL値としてある
--/*
DECLARE @beginning_date char(20)
DECLARE @ending_date char(20)
--SELECT @ending_date = '07/31/2016' --23:59:59'
--SELECT @beginning_date = '07/01/2016' --00:00:01'
--*/
SELECT --Sum(CASE when Billing_Ledger.subtype in ('BI','ND') then
--Billing_Ledger.amount ELSE 0 END) as 'Charges'
Patient_Clin_Tran.Clinic_id, Patient_Clin_Tran.service_id, Patient_Clin_Tran.program_id, Patient_Clin_Tran.protocol_id, billing_ledger.amount
FROM Billing_Ledger
JOIN Patient_Clin_Tran ON
Billing_Ledger.clinical_transaction_no = Patient_Clin_Tran.clinical_transaction_no
JOIN Coverage_Plan ON
Billing_Ledger.coverage_plan_id = Coverage_Plan.coverage_plan_id
and Billing_Ledger.hosp_status_code = Coverage_Plan.hosp_status_code
JOIN Payor ON
Coverage_Plan.payor_id = Payor.payor_id
WHERE (Coverage_Plan.billing_type <> 'CAP' or Coverage_Plan.billing_type is null)
and Billing_Ledger.accounting_date >= @beginning_date
and Billing_Ledger.accounting_date < dateadd(day, 1, @ending_date)
and Patient_Clin_Tran.Clinic_id = 'NP' and payor.name = 'Mainecare' and (Billing_Ledger.subtype in ('BI','ND'))
--GROUP BY Patient_Clin_Tran.Clinic_id, Patient_Clin_Tran.service_id, Patient_Clin_Tran.program_id, Patient_Clin_Tran.protocol_id --, Payor.Name, billing_ledger.amount, payor.type
ORDER BY Patient_Clin_Tran.Clinic_id, Patient_Clin_Tran.service_id, Patient_Clin_Tran.program_id, Patient_Clin_Tran.protocol_id
私は少し試してみましょう。私はそれが痛みであるSPを作らなければそれをする方法がないことを気づかなかった。私はその返事を感謝します。 –
私はテストシステムに入っており、次のエラーが発生しています。メッセージ102、レベル15、状態1、プロシージャcsp_payments_by_cspp、行4 '@ending_date'の近くの構文が正しくありません。 メッセージ137、レベル15、状態2、プロシージャcsp_payments_by_cspp、行23 スカラー変数 "@beginning_date"を宣言する必要があります。 宣言する必要はありますか? –
私の間違い、申し訳ありません。私はカンマを忘れてしまった。私は私の答えを編集します。 –