数据库中有 这样4个表 SIN,T_NODEVINDATA,tiles MotorCodeTiles。 MotorCodeTiles 表中分别有 SIN,TILES的主键,而没有T_NODEVINDATA的主键
SQL code:
select * from
(select rownum 序列号,P.*
from (select T_NODEVINDATA.EngineVin,Sin.MotorBlockCode,tiles.TilesCode, tiles.TilesName,
count(MotorCodeTiles.tilesid) 数量,MotorCodeTiles.blendtime
from MotorCodeTiles,Sin,Tiles,T_NODEVINDATA
where MotorCodeTiles.Sid = Sin.Sid
and Tiles.TilesId = MotorCodeTiles.TilesId
and T_NODEVINDATA.BARCODE = sin.MotorBlockCode
and MotorCodeTiles.blendtime
between to_date('2009-11-24','yyyy-MM-dd')
and to_date('2009-11-25','yyyy-MM-dd')
group by T_NODEVINDATA.EngineVin,sin.motorblockcode,tiles.tilescode,tiles.tilesname,MotorCodeTiles.blendtime
order by MotorCodeTiles.blendtime)p)
而查询出来的数据是应该查询出的数据的3倍。是条件给少了?请大虾指点指点
而查3个表就不会出现怎样的问题
SQL code:
select * from
(select rownum 序列号,P.*
from (select Sin.MotorBlockCode,tiles.TilesCode, tiles.TilesName,
count(MotorCodeTiles.tilesid) 数量,MotorCodeTiles.blendtime
from MotorCodeTiles,Sin,Tiles
where MotorCodeTiles.Sid = Sin.Sid
and Tiles.TilesId = MotorCodeTiles.TilesId
and MotorCodeTi