求高明的百分比sql语句
表 T如下
项目 金额
A01 100
A02 6
A03 10
A04 52
A05 91
A55 23
A78 32
A45 1
A88 2
随机取出 点 总金额20%的记录 除了循环有什么好办法??
SQL code:
top 20 percent....order by newid()
随机取出 点 总金额20%的记录
什么意思?
SQL code:
??
select * from [Table] where 金额*1.0/(select sum(金额) from [Table])>=0.2
不理解
SQL code:
----------------------------------------------------------------
-- Author :fredrickhu(我是小F,向高手学习)
-- Date :2010-02-03 16:15:40
-- Version:
-- Microsoft SQL Server 2005 - 9.00.4035.00 (Intel X86)
-- Nov 24 2008 13:01:59
-- Copyright (c) 1988-2005 Microsoft Corporation
-- Developer Edition on Windows NT 5.2 (Build 3790: Service Pack 1)
--
----------------------------------------------------------------
--> 测试数据:[tb]
if object_id('[tb]') is not null drop tab
相关问答:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jas ......
--drop table #T1
--drop table #T2
create Table #T1(ID int,
QueryID nvarchar(20),
ResultID1 nvarchar(20),
ResultID2 nvarchar(20))
create Table #T2(SortNo int,
QueryID nvarchar(20),
ResultID1 nv ......
可能因为工作的原因 接触数据库这块比较少,之前都是做程序这块,数据库这块都有专门的人来做 分工都很明细 所以对数据库这一块完全不了解。前段时间 去面试了几家公司 几乎都是在数据库这块挂掉的 连个简单的SQ ......
sqlserver2005 建立的数据库,与手持pda传输数据,最近突然出现无法传递数据的问题,pda端提示的错误时outofmemoryexception,但是pda上面的容量没有问题,
sqlserver的日子上的错误如下:
日期 2010-1-25 14:45: ......