在中合理的使用LEFTOUTERJOIN进行开发!
来源:互联网 发布:温润如玉的男人知乎 编辑:程序博客网 时间:2024/04/30 03:44
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
比如我们想对某人的消费项目进行汇总,对应以下两个表:Theme与ThemeDetail
Theme的记录为:
ThemeID(int) ThemeName(varchar[10])
1 就餐
2 出差
3 乘车
4 其它
ThemeDetail的记录为:
DetailID(int) ThemeID(int) Price(money)
1 1 12.5
2 1 5
3 1 6
4 2 11
5 2 17
6 3 8
其中Theme中的ThemeID与ThemeDetail中的ThemeID是一对多的关系,对ThemeDetail表的理解如下:“就餐”费用为12.5+5+6=23.5元,“出差”费用为11+17=28元,“乘车”费用为8=8元,“其它”费用不存在,视为0处理,对应的SQL语句可以这样表示:
SELECTTOP100PERCENTdbo.Theme.ThemeName,ISNULL(SUM(dbo.ThemeDetail.Price),0)1
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
比如我们想对某人的消费项目进行汇总,对应以下两个表:Theme与ThemeDetail
Theme的记录为:
ThemeID(int) ThemeName(varchar[10])
1 就餐
2 出差
3 乘车
4 其它
ThemeDetail的记录为:
DetailID(int) ThemeID(int) Price(money)
1 1 12.5
2 1 5
3 1 6
4 2 11
5 2 17
6 3 8
其中Theme中的ThemeID与ThemeDetail中的ThemeID是一对多的关系,对ThemeDetail表的理解如下:“就餐”费用为12.5+5+6=23.5元,“出差”费用为11+17=28元,“乘车”费用为8=8元,“其它”费用不存在,视为0处理,对应的SQL语句可以这样表示:
SELECTTOP100PERCENTdbo.Theme.ThemeName,ISNULL(SUM(dbo.ThemeDetail.Price),0)1
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
- 在中合理的使用LEFTOUTERJOIN进行开发!
- 在 SQL Server 中合理的使用 LEFT OUTER JOIN 进行开发!
- 在 SQL Server 中合理的使用 LEFT OUTER JOIN 进行开发
- 如何在程序中合理的使用空格
- 在你的应用中合理使用设计模式
- 如何在软件开发过程中合理的设计函数来解决实际问题
- 函数_如何在软件开发中合理的设计函数来解决实际问题
- Apache 中 KeepAlive 配置的合理使用
- Apache 中 KeepAlive 配置的合理使用
- Apache中KeepAlive的合理使用
- Apache 中 KeepAlive 配置的合理使用
- Apache 中 KeepAlive 配置的合理使用
- Apache 中 KeepAlive 配置的合理使用
- Apache 中 KeepAlive 配置的合理使用
- Apache 中 KeepAlive 配置的合理使用
- Apache 中 KeepAlive 配置的合理使用
- Apache 中 KeepAlive 配置的合理使用
- Apache 中 KeepAlive 配置的合理使用
- SQLServer驱动程序版本造成的中文问题。
- SQLServerNoResultSetSetwasproduced
- 查询结果的动态排序
- 视图的使用
- json-lib的使用
- 在中合理的使用LEFTOUTERJOIN进行开发!
- HOW TO:获取ExcelApplication COM对象的进程
- [转载]Java的沙箱机制
- 如何获得当前的SCN值
- sqlserver中插入值后,马上得到自动编号的值......
- 聚光灯的代码
- pl/sql程序编写中遇到的一些问题及解决办法
- Identity+Primarykey字段强行插入的处理
- Point