I am newbie in SQL Server 2008.There is a Proc.In this Proc, I have two select statements.When I execute my Proc, I will get results in two table which I accepted. But I want to this return in single table.
My 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
Please suggest me how is it possible??
Thanks in advance.