The used select statements have a different number of columns解決辦法
1. 問題原因
這個異常出現在兩個表使用union all進行合併時遇到的,
表A存在的欄位數量和表B最初是一致的,包括欄位名字和型別都是一致,使用union all連線無異常;
後來由於需要在表B添加了一個新的欄位,導致兩張表的欄位在數量上不一致,出現了異常;
2. 解決辦法
在使用union all進行合併操作時,使用null as "xxx"解決,如下,由之前的SQL語句
SELECT * FROM project t LEFT JOIN ( SELECT * FROM biz_a_contract UNION ALL SELECT * FROM biz_b_contract ) a ON a.id = t.contract_id WHERE t.id = '200'
改為
SELECT *
FROM project t
LEFT JOIN (
SELECT * FROM biz_a_contract
UNION ALL
SELECT tt.*,null AS 'xx' FROM biz_b_contract tt
) a ON a.id = t.contract_id
WHERE
t.id = '200'
或者直接列出具體的欄位,保證順序一致性
相關推薦
The used select statements have a different number of columns解決辦法
1. 問題原因 這個異常出現在兩個表使用union all進行合併時遇到的, 表A存在的欄位數量和表B最初是一致的,包括欄位名字和型別都是一致,使用union all連線無異常; 後來由於需要在表B添加了一個新的欄位,導致兩張表的欄位在數量上不一致,出現了異常;
The used SELECT statements have a different number of columns???
自己 lin ack -o _id strong clas 之前 不一致 今天我們組就我一個人留守在這裏修復bug了,有點小悲傷啊,他們都問我能不能hold得住啊,我當然能hold得住啊; 在看一個入庫的存儲過程中,在數據庫運行的時候是沒問題的,項目已啟動,進行入庫操作就是
UNION關鍵字報錯:ERROR 1222 (21000): The used SELECT statements have a different number of columns
今天進行總結時,發現這個錯誤,後來,發現這是由於union 造成。 在使用union時,有以下規則。 1.必須由兩條或者兩條以上的select語句組成,語句之間用關鍵字union分隔 2.每
創建Maven Module時報錯:The parent project must have a packaging type of POM
mage ren 分享 報錯 pom ima mave parent 目的 創建Maven Module時報錯:The parent project must have a packaging type of POM 解決的辦法,是把父項目的Packaging改
pycharm please specify a different SDK name的解決辦法
ren eas ann har setting 相同 arm save 解決辦法 在使用pycharm編程時,新建了一個project,很普通的project,結果報錯,提示Cannot save settings:Please specify a different SD
IllegalStateException: The specified child already has a parent,removeview()問題解決辦法
我在使用DropDownMenu的時候將佈局檔案的recycleview傳進setDropDownMenu的方法裡面,出現了IllegalStateException :The specified child already
qvalue: Check that you have valid p-values or use a different range of lambda
have lambda ... support 重現 style range cond port ERROR: The estimated pi0 <= 0. Check that you have valid p-values or use a different
ES報the same id but is a different node instance
request exc 解決 tran enabled iam job elastics 產生 ES啟動報如下錯誤[2018-10-06×××3:12:15,871][INFO ][o.e.d.z.ZenDiscovery ] [es3] failed to sen
The Best Way To Have A Quality Concrete Pump Machine Available For Sale
It is so simple to pinpoint a concrete pump online. You can get ones that have been made of excellent components. This equipment is going that wil
配置使用Eslint的時候 版本錯誤 "eslint": "5.6.0" a different version of eslint was detected higher up in the tr
1, 如果你也遇到下面的問題,你可以 按照命令列提示的那樣,下面這四步完成的一般就可以了,但是不排除你在執行的時候忘記下載某些依賴。 【1】 刪除 package-lock.json(不是package.json) 你可以選擇 yarn.lock 或者不要,我
搭建elasticsearch叢集報錯:with the same id but is a different node instance]; ]
記錄一下在安裝 elastic-search 單機多節點是時候報錯解決方案。 [INFO ][o.e.d.z.ZenDiscovery ] [slave-one] failed t o send join request to master [{mast
FAQ on the newly established MIT Stephen A. Schwarzman College of Computing
This set of FAQs offers information about the founding of the MIT Stephen A. Schwarzman College of Computing, announced today, and its implications for the
Resolve RegexSerDe Error "Number of matching groups doesn't match the number of columns" in Amazon Athena
CREATE external table logs(col1 string, col2 string, col3 string, col4 string, col5 string, col6 string, col7 string ) ROW FORMAT SERDE 'org.apa
SCP傳送文件時提示No ECDSA host key is known forx.x.x.x and you have requested strict checking.問題的解決辦法
quest str targe ecdsa conf com dev 相關 nss 在使用SCP向其他設備傳送文件時,打印如下錯誤: No ECDSA host key is known for x.x.x.x and you have requested strict c
selenium WebDriver提示Unable to find a matching set of capabilities解決方法
com arm community 並且 可用 fire drive cap win64 問題出在:應該將火狐瀏覽器驅動添加到火狐瀏覽器安裝目錄下,並且將火狐瀏覽器安裝目錄放在path下面。(出現大意,忘了在火狐瀏覽器下放其對應的驅動) 親測以下組合方式可用: pych
GitHub Desktop 出現“please upgrade your plan to create a new private repository”的解決辦法
ron net please vat tor blog 解決 pos sdn 轉:https://blog.csdn.net/qq_38584262/article/details/82386805 解決辦法:去掉最下面的勾 GitHub
JAVA型別直接輸入超過10位報The literal XXX of type int is out of range 解決辦法
Long.parseLong("XXX")或long number=xxxL java long與int取值範圍的問題 1:long l = 1024*1024*1024*4; //02:int i1 = 1024*1024*1024*4; //03:int i2 = 22000000000
Agreement has been updated--Edit Phone Number最便捷解決辦法(不需要安全提示問題和雙重認證)
但是這次要更新手機號(不知道要幹嘛),只能按照步驟跳到appleid的網站來修改。進入之後發現個嚴重的問題。。。安全提問的回答忘記了。。。賬號申請了好久,之前總以為自己記得,沒有儲存好(以後切記!!不管什麼資料,都要儲存一份)其實我們的目的只是要修改賬號資料,如果找到不需要驗證就能修改資料第方法就可以了。在網
Cannot get a STRING value from a NUMERIC cell問題的解決辦法
ann 解決辦法 info span from cell png spa ont 遇到以下錯誤的解決辦法: 在cell加個setCellType()方法就可以了 cell.setCellType(CellType.STRING); Cannot get a STRING
git遠端刪除分支後,本地git branch -a 依然能看到的解決辦法。
轉:https://blog.csdn.net/qq_16885135/article/details/52777871 使用 git branch -a 命令可以檢視所有本地分支和遠端分支(git branch -r 可以只檢視遠端分支) 發現很多在遠端倉庫已經刪除的分支在本地依然可以看到。