表名 lshg 字段名state 下面是是数据
13.58%
9.88%
29.82%
7.86%
失败
27.55%
9.27%
4.93%
16.67%
22.85%
16.56%
2.44%
5.80%
16.80%
14.14%
8.37%
9.38%
13.96
24.21%
10.75%
怎么给他进行重大到下排序
给自己顶个先
select * from lshg order by state desc
引用
select * from ls ......
table A
id income
1 120
2 211
3 116
........
table sum
id total
1 120 --1
2 331 --1+2
3 447 --1+2+3
........
如何按天汇总以来的收入,sql怎么写
select sum(Income) from Table
where Date between StartDate and ......
SELECT So_Master.sales, wf_status.Result, So_Master.so_no, So_Master.customer_name,
So_Master.pi_no
from So_Master INNER JOIN
wf_status ON So_Master.so_no = wf_status.doc_no
WHERE (So_Master.so_no = N'SCN091000304') OR
(So_Master.pi_no = N'V091000274') ......
两个表A,B连表查询,其中A有id,name字段,B有aid,cid字段,A.id和B.aid是关联的,B.cid有很多重复,请问怎样用一句话搜索出A.id,A.name,B.cid连表结果,其中各字段都不能有重复
是整条记录不能重复还是每个字段都不能重复?
如果有重复要怎么取?
SQL code:
select distinct A.id,A.name,B.cid
from A,B where A.id= ......
描述:数据库中字段和数字如下所示详情
其中status字段:o代表未清、l代表损失、w代表赢取
cardcode------------------cardcaname-------------status
c00001----------------------新巍峨-----------------o
c00001----------------------新巍峨-----------------o
c00001----------------------新巍峨-------------- ......
SQL code:
create table #tb1(ip nvarchar(20),date datetime)
insert into #tb1
select '10.110.120.114','2010-04-01 03:57:49' union all
select '10.119.123.130','2010-04-01 04:01:22' union all
select '10.110.120.114','2010-04-01 04:04:51' union all
select '10.110.120.114','2010-04-01 04:11:42' u ......