DINESH K MAURYA Ответов: 2

Как получить вывод в одном столбце.


CREATE TABLE address(
address1 varchar(15) NULL,
address2 varchar(15) NULL,
address3 varchar(15) NULL
) 
insert into address  
values (null, 'address2',Null)
insert into address 
values ('Address1', Null,Null)
insert into address 
values (Null, Null,'Address3')


как получить выход
Output
-------------
Address1
Address2
Address3
-------------


Что я уже пробовал:

SELECT  address1,address2,address3   FROM address group by address1,address2,address3

2 Ответов

Рейтинг:
1

itsmypassion

select ISNULL(address1 , isnull(address2,(isnull(address3,'')))) from address Order by 1


Рейтинг:
0

Karthik_Mahalingam

пробовать

select COALESCE(address1,address2,address3) as Addres from address  order by Addres

относиться Функция SQL Server COALESCE() [^]