简体   繁体   English

SQL查询中的ISNULL

[英]ISNULL IN SQL QUERY

Im stuck in returning of ISNULL it is always sample 3 我被困在返回ISNULL它总是sample 3

Is this is correct? 这是对的吗?

SELECT
  Text1, Text2, ISNULL(ISNULL(Sample1,Sample2), Description) as Text3
WHERE
  . . .

My Data in records Sample1 and Sample2 我的数据记录在Sample1Sample2

Sample1 | Sample2
a       | Null ---
Null    | b ---
Null    | Null ---
Null    | Null ---

Can some on help me? 可以帮我吗? I can't find some problem that is related in my problem. 我找不到与我的问题相关的问题。

You can use from query : 您可以使用查询:

SELECT Text1, Text2, COALESCE (Sample1,Sample2), Description) as Text3;

This is the correct query. 这是正确的查询。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM