问题一,Group 不分顺序,无论谁在前,结果都是一样的。问题二, 其他列要用 Aggregation 函数显示,例如SUM, MAX
解决方案 »
- 请问如何提高select ..where id in ()的查询效率
- select 的时候如何根据条件改变结果某个column的值?
- 查询同一表中某些字段相同,剩余字段不同的记录!
- 求一SQL查询语句
- 关于附加数据库问题.
- sql server 2005 express DTS 安装问题
- 如何向sqlserver 2008中导入.bak的文件
- 请大虾帮忙看看下面存储过程,有什么语法错误
- 这个sql语句怎么写?
- 我的数据库表有160亿条记录,我怎么让它短时间内按我的条件找出几千条符合条件的记录?
- Sql2005的Workstation ID在哪里啊(八百里加急)
- 误操作 update 后遇到的问题,无日志。
C:\Program Files\Common Files\Microsoft Shared\OFFICE11\2052\JETSQL40.CHM
JET-SQL 参考
http://download.csdn.net/source/351771Access使用的是Jet-SQL。 JET SQL 帮助(jet4 access2000)下载地址
http://www.access911.net/index.asp?board=8&recordid=75FAB71E&tt= [align=center]==== 思想重于技巧 ====
[/align]
go
insert into #tab1(id1,id2,id3)
select id1,id2,id3 from
(
select 1 as id1,1 as id2,1 as id3 union
select 1,2,3
) as tab
go
create table #tab(id1 int null,id2 int null,id3 int null)
go
declare @id1 int
declare curst cursor static for
select id1 from #tab1 group by id1
open curst
fetch next from curst into @id1
while @@fetch_status = 0
begin
insert #tab(id1,id2,id3) select top 1 id1,id2,id3 from #tab1
fetch next from curst into @id1
end
close curst
deallocate curst
select * from #tab
go
drop table #tab1
drop table #tab
go
假如以上结果集为A然后再按id2汇总A