SQL查询语句
共有12个表,每个表对应一个月的数据,表的属性有machine_id(用户标识),domain_id(网站标识),现在要查询
1 全年中各用户访问的网站数:select machine_id,count(distinct domain_id) from T1,T2,T3,……,T12 group by machine_id
2 12个月总的网站数:select count(distinct domain_id)from T1,T2,……,T12
这两个查询语句好像不正确,后面是否要加where之类的语句,光是from好像不能连接12个表吧,应该怎么编写SQL语句,请指点,谢谢~
union all
1不是用连接是用UNION ALL
2也是用UNION ALL
SQL code:
select machine_id,count(distinct domain_id) from
(select * from T1
union all
select * from T2
union all
……
select * from T12
)t
group by machine_id
SQL code:
where t1.machine_id=t2.machine_id
and
.....
SQL code:
select count(distinct domain_id) from
(select * from T1
union all
select * from T2
union all
……
select * from T12
)t
理解错误?
相关问答:
执行的顺序:
1)文件浏览框(选择文件使用)
选择好文件后
点击一个导入按钮的时候 ,把上面上传框里的csv文件以一个ID为文件名,上传到**/**文件夹下
2)读取这个文件夹下的csv的文件,转换成sql
3 ......
环境:1.win2003server+oracle9i
2.oracle9i字符集为AMERICAN_AMERICA.WE8ISO8859P1
3.oracle sql developer版本 1.5.5
现象描述: 1.在sql developer 中查询oracle中的某个表,中文全部显示为乱码。
......
access 中执行sql update语句时有时候成功有时候不成功,但是access中不出错误信息,不知道是什么原因,有哪位大侠知道,请帮忙啊
贴SQL语句,检查表、字段的有效性设置
sql 在查询分析器里面 执行很正常
是 ......
表 TT
字段 A1 A2 A3
1 B 2008/07/09
2 C & ......
如果用sql语句更改lj字段的路径,如下:
lj
7/200781616183095962.jar
8/f_200812111413292.jar
8/f_200812111413291.jar
得到的结果如下:
lj
1/7/200781616183095962.jar
1/8/f_20081 ......