-2

我想知道是否有办法编写常规Select * from...查询但只返回包含数据的字段,因为在任何完全为 NULL 的列中都不会返回?我在想临时表可能是可行的,但我不确定,快速谷歌没有产生任何结果。

原因是我正在查询一个包含数百列的表,其中 95% 是 NULL,那些有数据的表是我需要查看的。

4

2 回答 2

1

It's not possible by default (as far as i know). You can however write simple function which will unset NULL-valued keys from passed array. But i can't see point of it - please give us more informations about Your problem.

于 2013-09-27T10:49:18.873 回答
0

You can create a view with the required column and then use select * from view_name.

Create view V_sample
AS
select column1, column2 
from table

Then you can do:

select * from V_sample
于 2013-09-27T10:48:48.400 回答