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

用不同的列名堆疊兩個 sql 表 (2008)

stacking two sql tables (2008) with different column names(用不同的列名堆疊兩個 sql 表 (2008))
本文介紹了用不同的列名堆疊兩個 sql 表 (2008)的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

我檢查了這個站點的代碼來堆疊兩個表(將一個表的結(jié)果放在另一個表的結(jié)果下方),其中列名不同.我知道當名稱相同時 UNION ALL 有效..而且我知道 UNION ALL 對一個表中缺少的列名進行分配時,當一個表比另一個表具有更多信息時會起作用..但是如果該列會怎樣名字不一樣?就像如果在一張表中的列名稱是 CHP 而在另一張表中它是CHILD HEALTH PLUS"并且我需要將這兩列堆疊在一起會怎樣?

I checked this site for code to stack two tables (put the results from one table beneath the results from another) where the column names are different. I know that UNION ALL works when the names are the same.. and I KNOW THAT UNION ALL with an assignment for the column names that are missing from one table works when one table has more info than the other.. but what if the column names are different? like what if in one table the column name is CHP and in another it is "CHILD HEALTH PLUS" and I need those two columns to be stacked on top of one another?

推薦答案

只要列的數(shù)據(jù)類型相同,就可以使用 UNION.列名是否不同并不重要.

A UNION can be used as long as the datatypes of the columns are the same. It doesn't matter if the column names are different.

SELECT column1
FROM Table1
UNION
SELECT column1
FROM Table2

如果你想知道記錄來自哪個表,那么你可以添加另一個字段來區(qū)分行:

If you want to know which table the records are coming from, then you can add another field that will distinguish the rows:

SELECT column1, 'Table1' as TableName
FROM Table1
UNION
SELECT column1, 'Table2' as TableName
FROM Table2

這篇關(guān)于用不同的列名堆疊兩個 sql 表 (2008)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

相關(guān)文檔推薦

What SQL Server Datatype Should I Use To Store A Byte[](我應該使用什么 SQL Server 數(shù)據(jù)類型來存儲字節(jié) [])
Interpreting type codes in sys.objects in SQL Server(解釋 SQL Server 中 sys.objects 中的類型代碼)
Typeorm Does not return all data(Typeorm 不返回所有數(shù)據(jù))
Typeorm .loadRelationCountAndMap returns zeros(Typeorm .loadRelationCountAndMap 返回零)
How to convert #39;2016-07-01 01:12:22 PM#39; to #39;2016-07-01 13:12:22#39; hour format?(如何將“2016-07-01 01:12:22 PM轉(zhuǎn)換為“2016-07-01 13:12:22小時格式?)
MS SQL: Should ISDATE() Return quot;1quot; when Cannot Cast as Date?(MS SQL:ISDATE() 是否應該返回“1?什么時候不能投射為日期?)
主站蜘蛛池模板: 女朋友的闺蜜3韩国三级 | 欧美一区二区三区四区五区无卡码 | 日韩精品一区二区三区久久 | 中文字幕11页 | 一级黄色片美国 | 99九九久久 | 操操操日日日 | 日韩成人在线观看 | 欧洲精品码一区二区三区免费看 | 久久久久国产精品一区二区 | 欧美在线一区二区三区 | aa级毛片毛片免费观看久 | 国产999精品久久久久久 | 欧美三区 | 国内自拍偷拍 | 日韩精品在线一区 | 99在线免费观看视频 | 黄色大片免费播放 | 国产一级在线观看 | 欧美日韩成人 | 亚洲一区二区免费电影 | 欧美综合国产精品久久丁香 | 亚洲综合久久久 | 亚洲一区二区在线 | 欧美日韩一区在线播放 | 亚洲精品永久免费 | 视频一区二区在线观看 | 成人免费视频网 | 久久午夜国产精品www忘忧草 | www在线| 在线观看日韩av | 日韩一区二区不卡 | 免费在线播放黄色 | 日韩在线免费视频 | 成人妇女免费播放久久久 | 成人在线观看中文字幕 | 99精品国产一区二区三区 | 国产精品久久久久久久久久免费看 | 欧美日韩中文国产一区发布 | 91久久久久久久久 | 日韩综合在线 |