cari_list
SELECT
case when VadeOp.fisTermDate <= GETDATE() then 1 else 0 end as Vade,'aaa' as GroupCode,1 as guns,
ca.RecId, ca.TradeName, ca.CurrentAccountCode, ca.GroupId, ca.CurrentAccountName, ca.PriceGroupCode, t.Name + ' - ' + ca.TaxNo as TaxLine
FROM Erp_CurrentAccount ca
left join Meta_TaxOffice t on ca.TaxOfficeId=t.RecId
left join VadeOp on ca.CurrentAccountCode = (select top 1 [Cari Hesap Kodu] from VadeOp where Kalan>1 and Tipi != '' )
where ca.CompanyId = 1
order by ca.RecId;
SELECT
case when VadeOp.fisTermDate <= GETDATE() then 1 else 0 end as Vade,'aaa' as GroupCode,1 as guns,
ca.RecId, ca.TradeName, ca.CurrentAccountCode, ca.GroupId, ca.CurrentAccountName, ca.PriceGroupCode, t.Name + ' - ' + ca.TaxNo as TaxLine
FROM Erp_CurrentAccount ca
left join Meta_TaxOffice t on ca.TaxOfficeId=t.RecId
left join VadeOp on ca.CurrentAccountCode = (select top 1 [Cari Hesap Kodu] from VadeOp where Kalan>1 and Tipi != '' )
where ca.CompanyId = 1
order by ca.RecId;