在SELECT查询中的OLEDB案例 [英] OLEDB CASE WHEN in SELECT Query

查看:114
本文介绍了在SELECT查询中的OLEDB案例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将case when语句与oledb一起用于excel文件?
就像select prodid, case prodid when 1 then 'fine' when 2 then 'good' end

How can use case when statement with oledb to excel file ?
Like select prodid, case prodid when 1 then 'fine' when 2 then 'good' end

推荐答案

OLEDB只是一种中继",仅对基础源重复查询.

OLEDB is only a "relay" of sort and merely repeats the query to the underlying source.

我不认为Excel支持CASE WHEN构造,因此即使通过OLEDB也无法使用它.

I don't believe Excel supports the CASE WHEN construct, and thence you cannot use it, even through OLEDB.

您可以改为使用Excel特定的习惯用法,即

You can instead use an Excel-specific idiom, the IIF() function, as described in CodeByMoonlight's answer. As noted the need to nest IIF() calls makes is a rather messy proposal for situations that require more than 3 or 4 cases.

这篇关于在SELECT查询中的OLEDB案例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆