2017-04-13 49 views
0

我正在研究此查詢表單,我沒有找到任何答案。我不知道該怎麼做。在一箇中添加3列

所以,我有這個疑問這個結果:

Query + Result

代碼:

select distinct Phase as tt from table1 
     where phase is not null 

select distinct [ITV en cours] as tt from table1 
     where [ITV en cours] = 'OUI' 

select distinct Etat as tt from table1 
     where Etat like 'Ass%' 

我想讓這樣的事情

What i want to look like

哪有我這樣做?

+0

所以,你要所有三個結果集爲一個單一的一個? – Coder1991

回答

0

你可以插入或UNION ALL或工會,從而獲得所需結果

select distinct Phase as tt from table1 where phase is not null 
    union all 
    select distinct [ITV en cours] as tt from table1 where [ITV en cours] = 'OUI' 
    union all 
    select distinct Etat as tt from table1 where Etat like 'Ass%' 
+0

上帝..我試了很多東西..與樞軸,unpivot .. concat ..非常感謝你! – Reita

+0

是的,我剛剛投了票。再次感謝你! – Reita