急求教帮忙看下哪里不对(新手) SELECT A1.sd_id AS 收订单号,
A1.station_id AS 来源站点,
A1.station_id_aim AS 拣货站点,
A1.input_date AS 录单日期,
A1.verify_date AS 审核日期,
A1.is_hypotaxis as 主从订单
A2.verify_date AS 捡货用时
A3.last_mod_date AS 待发时间
FROM pre_sd A1,tj_dm_ck A2,db_fb A3
WHERE A1.input_date BETWEEN '2012-12-01' AND '2012-12-10' and a1.verify_date is not null ------解决方案-------------------- 差了两个逗号:
SELECT A1.sd_id AS 收订单号,
A1.station_id AS 来源站点,
A1.station_id_aim AS 拣货站点,
A1.input_date AS 录单日期,
A1.verify_date AS 审核日期,
A1.is_hypotaxis as 主从订单,
A2.verify_date AS 捡货用时,
A3.last_mod_date AS 待发时间
FROM pre_sd A1,tj_dm_ck A2,db_fb A3
WHERE A1.input_date BETWEEN '2012-12-01' AND '2012-12-10' and a1.verify_date is not null ------解决方案-------------------- SELECT A1.sd_id AS 收订单号,
A1.station_id AS 来源站点,
A1.station_id_aim AS 拣货站点,
A1.input_date AS 录单日期,
A1.verify_date AS 审核日期,
A1.is_hypotaxis as 主从订单
A2.verify_date AS 捡货用时
A3.last_mod_date AS 待发时间
FROM pre_sd A1,tj_dm_ck A2,db_fb A3
WHERE A1.input_date BETWEEN '2012-12-01' AND '2012-12-10'
and a1.verify_date is not null
and A1.关联号=A2.关联号
and A1.关联号=A3.关联号 ------解决方案-------------------- 没数据和表结构一时半刻看不出问题,但是瞄了一下,pre_sd A1,tj_dm_ck A2,db_fb A3这三个表应该要有一些关联条件的,但是你这里没有,所以是cross join,会出现大量不必要的数据甚至是不对的数据。