저는 SQL Server 2008에서 초보자입니다. Proc.In이 Proc에는 2 개의 select 문이 있습니다. Proc를 실행하면 두 개의 테이블에서 결과를 얻을 수 있습니다. 그러나 나는이 단일 테이블에있는 반환에 원한다.단일 결과 테이블에서 두 개의 쿼리가 필요합니까?
내 PROC -
ALTER PROC [GetPaymentGateway]
@CompanyID VARCHAR(3),
@ChannelType varchar(15)=null
AS
IF @ChannelType='BODC' OR @ChannelType='BO-DC'
BEGIN
SELECT [card_name], [card_type], [BODC_Amount], [BODC_Amount_Type], PGM.PG_Type FROM credit_card_master CCM
INNER JOIN PaymentGateway_master PGM
ON PGM.payment_gateway_code = CCM.payment_gateway_code
WHERE CCM.company_id = @CompanyID and CCM.disabled = '1'
SELECT PGM.Payment_Gateway_Name, PGNBC.BODC_Charge_Amt, PGNBC.BODC_Charge_type, PGM.PG_Type
FROM PG_NetBanking_Charges PGNBC
INNER JOIN PaymentGateway_master PGM
ON PGM.payment_gateway_code = PGNBC.payment_gateway_code
WHERE PGNBC.company_id = @CompanyID
END
IF @ChannelType='B2C' OR @ChannelType='ONLINE-DC'
BEGIN
SELECT [card_name], [card_type], [charge_amount], [B2C_Amount_type], PGM.PG_Type FROM credit_card_master CCM
INNER JOIN PaymentGateway_master PGM
ON PGM.payment_gateway_code = CCM.payment_gateway_code
WHERE CCM.company_id = @CompanyID and CCM.disabled = '1'
SELECT PGM.Payment_Gateway_Name, PGNBC.Online_DC_Charge_Amt, PGNBC.Online_DC_Charge_type, PGM.PG_Type
FROM PG_NetBanking_Charges PGNBC
INNER JOIN PaymentGateway_master PGM
ON PGM.payment_gateway_code = PGNBC.payment_gateway_code
WHERE PGNBC.company_id = @CompanyID
END
가능 얼마나 저를 제안하십시오?
미리 감사드립니다.
완료 .......... :) –