在查询分析器中这个语句可以用:
SELECT DISTINCT t_caig.material_id AS pn, avg(Case t_caig.curency_calssfy when 'USD' then t_caig.unit_price*8.041 when 'RMB' then t_caig.unit_price when 'NTD' then t_caig.unit_price/4 else 0 end) as pj
FROM t_caption INNER JOIN t_caig ON t_caption.indent_id = t_caig.indent_id
WHERE (t_caption.indent_date BETWEEN '2006-3-1' AND '2006-3-31')
GROUP BY t_caig.material_id但在access 中Case语句不能用,有什么函数语句可以在acess中代替sqlserve中的case呢, 我的access知道的很少,请大家帮帮忙!!
SELECT DISTINCT t_caig.material_id AS pn, avg(Case t_caig.curency_calssfy when 'USD' then t_caig.unit_price*8.041 when 'RMB' then t_caig.unit_price when 'NTD' then t_caig.unit_price/4 else 0 end) as pj
FROM t_caption INNER JOIN t_caig ON t_caption.indent_id = t_caig.indent_id
WHERE (t_caption.indent_date BETWEEN '2006-3-1' AND '2006-3-31')
GROUP BY t_caig.material_id但在access 中Case语句不能用,有什么函数语句可以在acess中代替sqlserve中的case呢, 我的access知道的很少,请大家帮帮忙!!
FROM dbo_t_caig INNER JOIN dbo_t_caption ON dbo_t_caig.indent_id = dbo_t_caption.indent_id
WHERE (((dbo_t_caption.indent_date) Between #3/1/2006# And #3/31/2006#))
GROUP BY dbo_t_caig.material_id;xeqtr1982(ShaKa),谢谢你,但这样出来的unit_price单价是乱码,而且还出现一个让输入币种的对话框
SQL:
select bb,cc,case aa when '一星级' then '*'
when '二星级' then '** '
when '三星级' then '*** '
when '四星级' then '**** '
when '五星级' then '***** '
end
from aaa----------------------
Access:select bb,cc,iif(aa='一星级','*',iif(aa='二星级','**',iif(aa='三星级','***',iif(aa='四星级','****',iif(aa='五星级','*****')))))
from aaa;