以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]SQL  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=50077)

--  作者:lshshlxsh
--  发布时间:2014/4/29 8:11:00
--  [求助]SQL

   select  a.finterid as 单据编号,a.fitemid as 物料,b.ferpclsid,b.fshortnumber,b.fname from icbomchild a left join t_icitem b on a.fitemid =b.fitemid where a.finterid =\'19751\'

 

请问一下,以上代码在查询表预览的时候显示多行,确定的时候只显示一条数据。如果把单据编号字段去掉,也会显示多行记录。请问这是什么原因?

[此贴子已经被作者于2014-4-29 8:12:22编辑过]

--  作者:Bin
--  发布时间:2014/4/29 8:26:00
--  
你确定你选择的是同一个数据源吗? 是的话没有理由哦,除非你设置了初始加载量为1
--  作者:有点甜
--  发布时间:2014/4/29 9:11:00
--  
有可能是这个原因:你a表的主键是 单据编号,而且没有系统列 _Identify?
--  作者:lshshlxsh
--  发布时间:2014/4/29 10:49:00
--  
谢谢你的回答。但finterid 不是主键,我用的是查询表。
--  作者:lshshlxsh
--  发布时间:2014/4/29 10:51:00
--  

我没有设置。

如果代码改为

select * from icbomchild a left join t_icitem b on a.fitemid =b.fitemid where a.finterid =\'19751\'
是可以显示的


--  作者:有点甜
--  发布时间:2014/4/29 12:27:00
--  

 那改成这样看看

 

select  [_Identify], a.finterid as 单据编号,a.fitemid as 物料,b.ferpclsid,b.fshortnumber,b.fname from icbomchild a left join t_icitem b on a.fitemid =b.fitemid where a.finterid =\'19751\'