SQL SERVER2005 数据库连表的问题,急急急!!

来源:百度知道 编辑:UC知道 时间:2024/05/30 05:25:42
这两个表是我这样查出来的:
SELECT * FROM PE_ClientHistory CH INNER JOIN PE_ClientHistoryItem CHI
ON CH.ClientHistoryID=CHI.ClientHistoryID
WHERE ActionName='合并客户'

GO

SELECT ClientHistoryID,FieldName,OldValue FROM PE_ClientHistoryItem

我现在想查出的效果是:
ClientHistoryID ClientID ActionName ActionTime UserIP UserName Remark ClientName Owner 这样的一个表。。。希望能得到大家的帮助,谢谢!

select PE_ClientHistory.ClientHistoryID ,ClientID,ActionName,ActionTime,UserIP,UserName,Remark,ClientName,Owner from PE_ClientHistory inner join PE_ClientHistoryItem on ON PE_ClientHistory.ClientHistoryID=PE_ClientHistoryItem.ClientHistoryID where ActionName='合并客户'

SELECT (写上你要的字段,如果字段名在两个表都有就用 表名.字段名) FROM PE_ClientHistory CH INNER JOIN PE_ClientHistoryItem CHI
ON CH.ClientHistoryID=CHI.ClientHistoryID
WHERE ActionName='合并客户'