Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
patricklawrence
Starting Member
1 Post |
Posted - 2011-12-06 : 12:07:19
|
evening alli am trying to sub query over a few tables to create a single table. i am getting an error when runing my code that the sql statement is not correct and that the . should be replaced with into or from. could someone please help here is my sql snytaxSELECT IC140M.WBPPN, DE100M.CMDESC, IC140M.WBCO, IC140M.WBWHNO, DE100M.PMPLNT, IC130M.LLLTNO, IC130M.LLSTLC, DE100M.PMASCT, IC130M.LLBLT3, DE100M.AMSSKFROM C103B0AP.AADAT12.DE100M DE100M, C103B0AP.AADAT12.IC130M IC130M, C103B0AP.AADAT12.IC140M IC140M, WHERE DE100M.IZPN = IC140M.WBPPN AND IC140M.WBPPN = IC130M.LLPPN AND DE100M.PMPLNT = IC140M.WBPLNT AND IC140M.WBWHNO = IC130M.LLWHNO AND((IC130M.LLLTNO='USA') AND (IC130M.LLBLT3<>0)) AND IC140M.WBPPN = (SELECT DISTINCT MS150M.FCPN, MS150M.FCCO, MS150M.FCWHSE, MS150M.FCPLNT, MS150M.FCDTYP, MS150M.FCCSTR, sum(MS150M.FCSQTY), MS150M.FCIND, SUM(MS150M.FCUQTY) FROM AADAT12.MS150M MS150M GROUP BY MS150M.FCPN, MS150M.FCCO, MS150M.FCWHSE, MS150M.FCPLNT, MS150M.FCDTYP, MS150M.FCCSTR, MS150M.FCIND) |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-12-06 : 12:17:27
|
this is invaliedIC140M.WBPPN = (SELECT DISTINCT MS150M.FCPN, MS150M.FCCO, MS150M.FCWHSE, MS150M.FCPLNT, MS150M.FCDTYP, MS150M.FCCSTR, sum(MS150M.FCSQTY), MS150M.FCIND, SUM(MS150M.FCUQTY) FROM AADAT12.MS150M MS150M GROUP BY MS150M.FCPN, MS150M.FCCO, MS150M.FCWHSE, MS150M.FCPLNT, MS150M.FCDTYP, MS150M.FCCSTR, MS150M.FCIND)you need to replace it with a join.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|
|
|