如何检查选择查询中间的空值,并从该位置的另一个表中显示值,如果该空值? [英] How do I check null values in the middle of select query and display value from another table in the place if that null value?

查看:99
本文介绍了如何检查选择查询中间的空值,并从该位置的另一个表中显示值,如果该空值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在sql 2008中使用存储过程显示表时,如果列中有空值而不是该值,则应显示另一个表中的值。请建议查询

while displaying a table using stored procedure in sql 2008, if there is a null value in a column, instead of that null, value from another table for should be displayed. Pls suggest a query

推荐答案

SQL Server仅为此要求提供 COALESCE 运算符 - ^ ]。

在sqlserver中使用Coalesce() [ ^ ]提供了一些示例。
SQL Server provides a COALESCE operator just for this requirement - COALESCE (Transact-SQL)[^].
Using Coalesce() in sqlserver[^] provides some examples.


这篇关于如何检查选择查询中间的空值,并从该位置的另一个表中显示值,如果该空值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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