SELECT dbo.StInstMast.StInstMastID, dbo.StInstMast.UN, dbo.StInstMast.UC, dbo.StInstMast.LocID, dbo.StInstMast.SecID, dbo.StInstMast.StInstNo, dbo.StInstMast.DrAcmastId, dbo.StInstMast.DrAcHeadId, dbo.StInstMast.DrAcSubId, dbo.StInstMast.SInstPrdType, dbo.StInstMast.FromDt, dbo.StInstMast.ToDt, dbo.StInstMast.SInstTrType, dbo.StInstMast.SInstModeType, dbo.StInstMast.IntwlPrd, dbo.StInstMast.IntwlPrdType, dbo.StInstMast.IsEndOfMonth, dbo.StInstMast.AmountType, dbo.StInstMast.Amount, dbo.StInstMast.DueDtType, dbo.StInstMast.CrAcmastId, dbo.StInstMast.CrAcHeadId, dbo.StInstMast.CrAcSubId, dbo.StInstMast.CrAcAtType, dbo.StInstMast.CrOrgMastId, dbo.StInstMast.CrOrgBrMastId, dbo.StInstMast.CrLocId, dbo.StInstMast.IsStop, dbo.StInstMast.StopDt, dbo.StInstMast.StopReason, dbo.AcSub.salute AS DrSalute, dbo.AcSub.Name AS DrName, dbo.AcSub.Account AS DrAccount, dbo.AcSub.ShortAc AS DrShortAc, AcSub_1.Account AS CrAccount, AcSub_1.salute AS CrSalute, AcSub_1.Name AS CrName, AcSub_1.ShortAc AS CrShortAc, dbo.StInstMast.MID, dbo.StInstMast.CrRemark, dbo.StInstMast.DrRemark, AcSub_1.Pfix AS CrPfix, AcSub_1.Vcno AS CrVcno, AcSub_1.Sfix AS CrSfix, dbo.StInstMast.Dt, dbo.StInstMast.VcTypeSubId, dbo.StInstMast.Pfix, dbo.StInstMast.Vcno, dbo.StInstMast.Sfix, dbo.LocSec.BrPfix, dbo.LocSec.name AS BrName, ISNULL(AcSub_1.IsClosed, 0) AS CrIsClosed, ISNULL(dbo.AcSub.IsClosed, 0) AS DrIsClosed, dbo.StInstMast.ToUserId, dbo.StInstMast.IsUserLevel, dbo.StInstMast.ReminDays, dbo.StInstMast.IsRemind, dbo.StInstMast.TNo, dbo.StInstMast.T, dbo.Account.Account AS DrAcParentName, dbo.Account.Pfix AS DrAcPfix, dbo.Account.Accountk AS DrAcParentNameK, Account_1.Account AS CrAcParentName, Account_1.Pfix AS CrAcPfix, Account_1.Accountk AS CrAcParentNameK, dbo.Account.PrintOrder AS DrPrintORder, Account_1.PrintOrder AS CrPrintOrder, dbo.AcSub.Pfix AS DrPfix, dbo.AcSub.Vcno AS DrVcno, dbo.AcSub.Sfix AS DrSfix FROM dbo.StInstMast LEFT OUTER JOIN dbo.AcSub AS AcSub_1 ON dbo.StInstMast.CrAcSubId = AcSub_1.AcMastId INNER JOIN dbo.Account ON dbo.StInstMast.DrAcmastId = dbo.Account.AcMastId INNER JOIN dbo.Account AS Account_1 ON dbo.StInstMast.CrAcmastId = Account_1.AcMastId LEFT OUTER JOIN dbo.LocSec ON dbo.StInstMast.LocID = dbo.LocSec.LocSecId LEFT OUTER JOIN dbo.AcSub ON dbo.StInstMast.DrAcSubId = dbo.AcSub.AcMastId WHERE (dbo.StInstMast.R = 0) AND (dbo.StInstMast.IsUserLevel = 0)