现有这样的查询语句:
select ID, Sum(Degree)/Sum(Weight) as dw from DegreeTable
group by ID.
但是,如果Sum(Weight)为零的话,我想执行下面的语句,因为除数不允许为零。
select ID, Sum(Degree) from DegreeTable group by ID.
怎么把两个语句合成一个SQL语句啊?
...全文
684打赏收藏
这样的查询语句让我伤脑筋?只得向各位请教了,救命啊!!!!
现有这样的查询语句: select ID, Sum(Degree)/Sum(Weight) as dw from DegreeTable group by ID. 但是,如果Sum(Weight)为零的话,我想执行下面的语句,因为除数不允许为零。 select ID, Sum(Degree) from DegreeTable group by ID. 怎么把两个语句合成一个SQL语句啊?