![](/img/trans.png)
[英]How to compare two tables in SQL if 2 columns have the same data - Codeigniter?
[英]Join two different sql tables with columns that have the same data
我有兩個正在執行的不同的sql語句,如果刪除不明確的列,則一個有效,另一個有效。 有沒有一種方法可以指定我要從兩個表中獲取信息的列?
select * from currentprojects
Join Group on Group.projectcode= currentprojects.projectcode
這是第一個語句,它有效,但是顯示表時整個頁面都會中斷。
SELECT
name,
projectid,
projectcode,
completiondate,
meeting,
status
FROM currentprojects
Join Group on Group.status= currentprojects.projectcode
如果我從查詢中刪除項目代碼,則第二條語句有效,但是我希望兩個數據集都顯示不同的內容。
嘗試這個。 一旦查詢開始變得密集起來,別名便會有所幫助
SELECT cp.Cloumn, g.Column
FROM currentprojects cp
INNER JOIN Group g ON g.projectcode= cp.projectcode
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.