表1的SQL
select
wsm_datahead.gettime as gettime,wsm_data_3.dataid as datid,wsm_data_3.data1 as datasw
from
wsm_data_3,wsm_DataBlock,wsm_datahead
WHERe
wsm_data_3.DataBlockID=wsm_DataBlock.DataBlockID
and
wsm_DataBlock.dataheadid=wsm_datahead.dataheadid
and
MHID=1112
表2的SQL
合并的条件是
表1的on wsm_datahead.gettime as gettime 的时间大概时间等于表2的wsm_datahead.gettime as gettime2时间误差不多于1个小时左右就合并显示为一条数据
显示的格式为
wsm_data_3 asdataid,wsm_data_3.data1 as datasw,data_7.data1 as databg,wsm_datahead.gettime
如果大家没看清楚了提示下其实这里涉及4个表.