我要根据同一个userid和某些条件,从3个表里面取出出6个count统计值sql 语句怎么写更合理些?
解决方案 »
- 获取IP地址的问题
- Asp.Net 怎样获取汉字五笔编码
- .net和javascript高手请进
- DataGrid中的DataItem问题
- treeview 问题
- (挑战你的智慧)谁有在自定义控件中使用资源文件实现本地化的代码例子????
- 请问代码里面的sqlCon需要Close吗?
- 变态任务!555~~~~~~~~
- ASP.NET 程序急求高手帮忙看下~ 先谢谢了~
- DATAGRID问题??如果我要其中的某一行不显示<asp:EditCommandColumn CancelText="取消" UpdateText="更新" EditText="修改"></asp:EditC
- session框架内丢失问题,大家出出主意,谢谢!
- 在.net2003中File Field组件的小问题
我需要同时求出:
select count(*) from tab1 where userid=01 and flag=1,
select count(*) from tab1 where userid=01 and deleted=0,
select count(*) from tab2 where userid=01 and flag=1,
select count(*) from tab2 where userid=01 and flag=0,
select count(*) from tab3 where userid=01 and flag=1,
select count(*) from tab3 where userid=01 and deleted=1,诸如这样的
(select count(*) from tab1 where tab1.userid=ttt.userid and flag=1) tmp1,
(select count(*) from tab1 where tab1.userid=01 and deleted=0) tmp2,
(select count(*) from tab2 where tab2.userid=01 and flag=1) tmp3,
(select count(*) from tab2 where tab2.userid=01 and flag=0) tmp4,
(select count(*) from tab3 where tab3.userid=01 and flag=1) tmp5,
(select count(*) from tab3 where tab3.userid=01 and deleted=1) tmp6
FROM tab1 ttt