简体   繁体   中英

ISNULL IN SQL QUERY

Im stuck in returning of ISNULL it is always sample 3

Is this is correct?

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

My Data in records Sample1 and Sample2

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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