![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
SELECT a.[UserID],b.[Name],sum (c.[Money]+c.[Bank])as TotalMoney
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
FROM Table1 a(nolock)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
LEFT JOIN Table2 b(nolock) on a.[UserID] = b.[UserID]
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
LEFT JOIN Table3 c(nolock) ON b.[UserID]=c.[UserID]
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
WHERE a.[UserID] = b.[UserID] and a.[UserID] = c.[UserID] and a.[Time] >= '2005-01-01' AND a.[Time] <= '2006-12-31'
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
GROUP BY a.[UserID],b.[Name]
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
ORDER BY a.[Time] DESC
优化一下
================================================================================
Left Join 语法:
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
select * from
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
table1 left join table2 on 条件1
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
left join table3 on 条件2
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
left join table4 on 条件3
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
where 条件4
GROUP BY 说明: