久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

將多個布爾列合并為一列

Combine multiple boolean columns into a single column(將多個布爾列合并為一列)
本文介紹了將多個布爾列合并為一列的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我正在從一個 ERP 系統生成報告,其中為用戶提供了一個復選框,該復選框為所選的每個項目返回一個布爾值.數據庫托管在 SQL Server 上.

I am generation reports from an ERP system where users are provided with a check box which return a boolean value for each item selected. The database is hosted on SQL Server.

但是,用戶也可以選擇具有其他值的合同,如下所示.

However, users can select Contracts with other values as well, as shown below.

我想將類別捕獲為單列,并且我不介意視圖中有重復的行.對于相同的參考 ID,我希望第一行返回 Contract,第二行返回選擇的其他值.

I would like to capture the Categories as a single column and I don't mind having duplicate rows in the view. I would like the first row to return Contract and the second the other value selected, for the same Reference ID.

推薦答案

您可以使用 apply :

select distinct t.*, tt.category
from t cross apply
     ( values ('Contracts', t.Contracts),
              ('Tender', t.Tender),
              ('Waiver', t.Waiver),
              ('Quotation', t.Quotation)
     ) tt(category, flag)
where flag = 1;

這篇關于將多個布爾列合并為一列的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Modify Existing decimal places info(修改現有小數位信息)
The correlation name #39;CONVERT#39; is specified multiple times(多次指定相關名稱“CONVERT)
T-SQL left join not returning null columns(T-SQL 左連接不返回空列)
remove duplicates from comma or pipeline operator string(從逗號或管道運算符字符串中刪除重復項)
Change an iterative query to a relational set-based query(將迭代查詢更改為基于關系集的查詢)
concatenate a zero onto sql server select value shows 4 digits still and not 5(將零連接到 sql server 選擇值仍然顯示 4 位而不是 5)
主站蜘蛛池模板: 91网在线播放 | 亚洲 91| 国产在线不卡 | 最新黄色在线观看 | 国产欧美一区二区三区在线看蜜臀 | 在线看黄免费 | 日韩福利在线观看 | 91在线视频在线观看 | 国产高清免费视频 | h视频在线免费 | 日韩精品一区二区三区中文字幕 | 亚洲精品日本 | 日韩一二三区视频 | 久久伊 | www.天天操| 久久久久久久久久久国产 | 九九精品在线 | 精品久久久久久久久久久久 | 91精品国模一区二区三区 | 一级a性色生活片久久毛片 一级特黄a大片 | 涩涩99| 99久久99| 99精品一级欧美片免费播放 | 国产精品欧美日韩 | 一级在线| 国产丝袜一区二区三区免费视频 | 美女一级毛片 | 狠狠av| 欧美一区免费 | 北条麻妃99精品青青久久主播 | 欧美色视频免费 | 91视频国产一区 | 精品在线一区 | 国产视频三区 | 国产综合久久 | 中文字幕在线观看成人 | 欧美人人 | 欧美日韩综合视频 | 亚洲欧洲精品一区 | 99久久亚洲 | 色毛片 |