# SQL 查询问题

0

A

1

1

2

4

A         Num

1            1

1            1

2            2

4            3

like%'远远'% | 小虾三级 | 园豆：635

0

`------分组显示示例IF NOT OBJECT_ID('[XXX]') IS NULLDROP TABLE [XXX]GOCREATE TABLE [XXX]([TID] int)goINSERT [XXX] SELECT 1 UNION ALLSELECT 1 UNION ALLSELECT 2 UNION ALLSELECT 4GO----select * from XXX/*TID1124*/select TID,(dense_Rank() over (order by TID asc)) as numfrom xxx/*TID    num1    11    12    24    3*/`

like%'远远'% | 园豆：635 (小虾三级) | 2011-04-19 10:55

0

num的公式是？？

0

distinct    order by

0

select case A when A的值 then  NUM

when A的值 then  NUM

end

from 表名

select row_number() over(order by Month_Rating desc) as 'Row_Id',*
from (select distinct a.SUP_MANAGE_ID,b.SUP_NAME,(select CAST(SUM(SUP_ASSESS_POINT)/COUNT(0) as numeric(5,2))
from ASSESS_SUP_CLOSE_POINT where SUP_MANAGE_ID=a.SUP_MANAGE_ID and ORGANISE_ID='YFJC00' and YEAR_MONTH_STR between '201001' and '201003') as 'Month_Rating'
from ASSESS_SUP_CLOSE_POINT a inner join SUP_INFO b on a.SUP_MANAGE_ID=b.SUP_MANAGE_ID where ORGANISE_ID='YFJC00' and YEAR_MONTH_STR between '201001' and '201003') a

0

int tmpInt = 1;
for (int i = 0; i < dt.Rows.Count; i++)
{
if (i == 0)
{
dt.Rows[i]["SUP_ASSESS_ORDER_NO"] = tmpInt;//默认第一行给1
}
else
{
if (dt.Rows[i]["SUP_ASSESS_ORDER_NO"].ToString() != dt.Rows[i - 1]["SUP_ASSESS_ORDER_NO"].ToString())//当前一行与上一行的比较，如果不等，则 +1
{
tmpInt++;
}
dt.Rows[i]["SUP_ASSESS_ORDER_NO"] = tmpInt;
}
}

0

select a.A,b.Num from Tb  a inner join (select row_number() over  (order by A) as Num,A from tb group by A) as b on a.A = b.A

0

select *  from (select row_number() over  (order by A) as Num,*  from tableName) as tt

avic_ren | 园豆：373 (菜鸟二级) | 2011-04-18 17:26
0

select  Table1.A, temp_table1.Expr1  from (
SELECT     A, row_number() over (ORDER BY A)  AS Expr1
FROM         (SELECT DISTINCT A
FROM          Table1
) AS derivedtbl_1 ) temp_table1 join   Table1
on temp_table1.A=Table1.A

MingQ | 园豆：312 (菜鸟二级) | 2011-04-19 11:55

您需要登录以后才能回答，未注册用户请先注册