avatar
SQL Conditional Select# Database - 数据库
V*N
1
我们去年底交的485,打了指纹,没消息了,不知道最近拿到卡的人在交了485后 都是
等了多久拿到卡的,多谢。
avatar
m*t
2
只是单纯不喜欢曾的,也还可以理解了。但是那些很恨曾,用尽各种难听词汇去恶意中
伤的,原因是什么呢?这么大的恨?不能只是选择不听她的歌,听自己喜欢的歌手的歌
么?
有人说是因为曾这种水平还挤进了20强,挤掉了其他更好的选手的名字。
OK,冷静下来想想,一个地方电视台草根选秀节目,前20强,19名和21名有什么区别啊
?任何方面?谁会记住他们?谁会包装他们?谁会奖励他们?都不会啊,为什么这么较
真呢?谁记得张靓颖那届第7名叫什么,现在在干什么?工作和音乐相关么?no
也有人说,只是太不公平了,看不过眼。
好吧,公平不是从曾进20这一刻才被质疑的。如果去搜一下包小柏和郑阳做评委的那场
海选,就能看到一个选手的外形条件多么大的程度上影响着她能否通关。创作好歹和音
乐相关,外形呢?
还听到过有人说,曾唱得难听就罢了,还出来吓人就是她的不对了。
你如果去参加海选,知道自己会是第几名么?那些老奶奶都来参赛了,还有只会唱黄河
大合唱和国际歌的,她们也是本着故意吓人的目的么?难道这个选秀不就是因为有很多
非预先设计好的地方,没有任何门槛的参赛才有趣么?不然,像星光大道,真的不能更
假了。。。
也有人说,
avatar
i*a
3
SQL 2005, Have the following data
seq ID month type amount
1 1234 1 R 421
2 1234 1 Cr 410
3 1234 1 Inv 430
1 1234 2 Cr 625
2 1234 2 Inv 650
1 1234 3 Inv 916
1 1234 4 Inv 882
How to get the rows of Inv and Cr, only when Cr exists for that month, and
the difference between Cr and Inv
example result:
1234, 1, Cr, 410
1234, 1, Inv, 430, difference 20
1234, 2, Cr, 625
1234, 2, Inv, 650, difference 25
avatar
i*a
4
found this example. can do calculation from the sub query
CREATE TABLE Sales (DayCount smallint, Sales money)
CREATE CLUSTERED INDEX ndx_DayCount ON Sales(DayCount)
go
INSERT Sales VALUES (1,120)
INSERT Sales VALUES (2,60)
INSERT Sales VALUES (3,125)
INSERT Sales VALUES (4,40)
select *
from Sales
SELECT DayCount,
Sales,
coalesce((SELECT Sales
FROM Sales b
WHERE b.DayCount = a.DayCount+1), 0)
AS NextDaySales
FROM S
avatar
s*6
5
select k.ID,k.mon,k.type,k.amount,
( select case k.amount-amount
when 0 then NULL
else k.amount-amount
end

from table where ID=k.id and MON=k.mon and TYPE='CR') as difference
from table as k,
(select ID,MON,COUNT (*) as test from table
where TYPE='Cr' or TYPE='Inv'
group by ID,MON having COUNT(*)>1) as s
where k.id=s.id
and k.mon=s.mon
and (k.TYPE='Cr' or k.TYPE='Inv')
avatar
i*a
6
thanks!
I followed the example on 2nd post and got the result.

【在 s*******6 的大作中提到】
: select k.ID,k.mon,k.type,k.amount,
: ( select case k.amount-amount
: when 0 then NULL
: else k.amount-amount
: end
:
: from table where ID=k.id and MON=k.mon and TYPE='CR') as difference
: from table as k,
: (select ID,MON,COUNT (*) as test from table
: where TYPE='Cr' or TYPE='Inv'

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。