CREATE VIEW [dbo].[V_Search_Rasid_TmpHavaleh]
AS
SELECT     dbo.Guy.Guy_Code, dbo.Guy.Name, dbo.TmpHeadH.Id_Havaleh, dbo.TmpHeadH.Kind_Flag, dbo.TmpHeadH.User_id, dbo.TmpHeadH.Nu_Resid, 
                      CAST(dbo.TmpHeadH.Note AS nvarchar(150)) AS Note
FROM         dbo.TmpHeadH INNER JOIN
                      dbo.TmpHavaleh ON dbo.TmpHeadH.Id_Havaleh = dbo.TmpHavaleh.Id_Havaleh INNER JOIN
                      dbo.Guy ON dbo.TmpHavaleh.Sender = dbo.Guy.Guy_Code
WHERE     (dbo.TmpHeadH.kind_Save = '0')
GROUP BY dbo.Guy.Guy_Code, dbo.Guy.Name, dbo.TmpHeadH.Nu_Kharid, dbo.TmpHeadH.Id_Havaleh, dbo.TmpHeadH.Nu_Bargasht_Forosh, dbo.TmpHeadH.Kind_Flag, 
                      dbo.TmpHeadH.User_id, dbo.TmpHeadH.Nu_Resid, CAST(dbo.TmpHeadH.Note AS nvarchar(150))
HAVING      (dbo.TmpHeadH.Kind_Flag = '2')
