【问题标题】:Comparing two rows, one from one table and where it doesn't match in another比较两行,一个来自一个表,另一个不匹配
【发布时间】:2014-02-27 14:56:47
【问题描述】:

如果我有表 dbo.PortsBaselineTabledbo.PortsTable

每个都有完全相同的列名:

[Date],[Plant],[ComputerName],[Protocol],[LocalAddress],[LocalPort],[RemoteAddress],[RemotePort],[State],[ProcessName],[Baseline]

我希望能够查询由此产生的差异。 dbo.PortsBaselineTable 将有大约 6000 行,Baseline Column 将具有数字“1”,dbo.PortsTable 将不断添加数据,Baseline Column 将具有所有行的“0”。我想从每个表中选择两个日期,然后根据两个特定日期比较所有不同的行,然后按计算机名称分组。

这甚至可行吗?当我添加更多数据时,我会介意将数据放在同一个表中,而基线标志会发生变化。

这是结果集的快照:

日期 工厂 ComputerName 协议 LocalAddress LocalPort RemoteAddress RemotePort State ProcessName Baseline 2014-01-30 07:52:58 工厂名称计算机名称 TCP 10.10.40.100 49157 192.168.0.2 64807 已建立 lsass 1

【问题讨论】:

    标签: sql-server compare rows


    【解决方案1】:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-16
      • 1970-01-01
      • 2019-05-28
      • 2012-01-31
      • 1970-01-01
      相关资源
      最近更新 更多