DROP TABLE IF EXISTS vv_PartnerConnectionInfoConnect;
DROP VIEW IF EXISTS vv_PartnerConnectionInfoConnect;
CREATE view vv_PartnerConnectionInfoConnect
as
  select 
  t1.MainType MainType,
  t1.Oid Oid,
  t1.CustomersFrom CustomersFrom,
  t1.Customers Customers,
  t1.PartnerType PartnerType,
  t1.ConnectInfo ConnectInfo,
  t1.CurrencyName CurrencyName,
  t1.DebitTotalHUF DebitTotalHUF,
  t1.CreditTotalHUF CreditTotalHUF,
  t1.DebitTotalDEV DebitTotalDEV,
  t1.CreditTotalDEV CreditTotalDEV,
  t1.BallanceHUF BallanceHUF,
  t1.BallanceDEV BallanceDEV,
  t1.ShortName ShortName,
  t1.Description Description,
  t1.DateExecution DateExecution,
  t1.DateCreated DateCreated,
  t1.DatePayment DatePayment,
  t1.DelayedDay DelayedDay,
  t1.DelayedRange DelayedRange,
  t1.CurrencyName_Account CurrencyName_Account,
  t1.AmountHUF_Account AmountHUF_Account,
  t1.AmountDEV_Account AmountDEV_Account,
  t1.DateExecution_Account DateExecution_Account,
  t2.BallanceState BallanceState,
  t2.BallanceRateDiff BallanceRateDiff
  from vv_PartnerConnectionInfoDetail t1
       join vv_PartnerConnectionInfoDetailGroup t2 on
  t1.CustomersFrom=t2.CustomersFrom and
  t1.Customers=t2.Customers and
  t1.PartnerType=t2.PartnerType and
  t1.ConnectInfo=t2.ConnectInfo

