我回答了以下问题question link。但我付出严厉的行为。 当我写这篇文章为什么当我使用max而不是count时出现问题
Update product Set [order]= Case when Not Exists (Select * from
product a where a.ProductTypeID =product.ProductTypeID and a.id
<product.ID)
tHEN 1
eLSE
((Select cOUNT([ORDER])+1 from product b where
b.ProductTypeID =product.ProductTypeID and product.ID <product.id)+1)
eND
它运作良好,但是当我写的......”
Update product Set [order]= Case when Not Exists (Select * from
product a where a.ProductTypeID =product.ProductTypeID and a.id
<product.ID)
tHEN 1
eLSE
((Select Max([ORDER])+1 from product b where
b.ProductTypeID =product.ProductTypeID and product.ID <product.id)+1)
eND
这是在给别人的情况我不明白为什么无效?谁能解释这时候我丢失的原因当我使用Max.Here是sql提琴http://sqlfiddle.com/#!3/1e15d/1我在哪里使用计数当我使用最大它给null为什么?
但如果我申请两个reutrn INT为int的列看到问题.....链接当我使用指望它工作,但是当我使用最多它返回null不会... – 2013-04-27 06:26:31
没有它没有....它当我使用计数诠释它的作品,但是当我使用Max代替计数它给null ...为什么是... lyk那...] – 2013-04-27 06:28:38
我只是wana知道为什么它会给出null当我在上面使用Max时... sql语句 – 2013-04-27 06:30:22