sql語句....頭都暈了...
后台可带出资料,但是在前台时。记录集个数提示为-1 ....救命啊。。。SELECT MD002, TA003, TB001, TB002, TA009, TA010, TA006, TA034, TA035, TA015, TA007, TA026, TA027, TA028, TC012, TC004, MA002, MD016, MD003,
MB002, MB003, MD004, MD006, TB004, TB017
FROM (SELECT m.TA001, m.TA002, m.TA003, m.TA009, m.TA010, m.TA006, m.TA034, m.TA035, m.TA012, m.TA015, m.TA007, m.TA026, m.TA027, m.TA028,
m.TC012, m.TC004, m.MA002, n.TB014, n.TB006, n.TB001, n.TB002, n.TB003, n.TB012, n.TB013, n.TB007, n.TB004, n.TB017, n.MD001,
n.MD002, n.MD009, n.MD016, n.MD003, n.MB002, n.MB003, n.MD004, n.MD006, n.MD007
FROM (SELECT dbo.MOCTA.TA001, dbo.MOCTA.TA002, dbo.MOCTA.TA003, dbo.MOCTA.TA009, dbo.MOCTA.TA010, dbo.MOCTA.TA006,
dbo.MOCTA.TA034, dbo.MOCTA.TA035, dbo.MOCTA.TA012, dbo.MOCTA.TA015, dbo.MOCTA.TA007, dbo.MOCTA.TA026,
dbo.MOCTA.TA027, dbo.MOCTA.TA028, c.TC012, c.TC004, c.MA002
FROM dbo.MOCTA INNER JOIN
(SELECT dbo.COPTC.TC001, dbo.COPTC.TC002, dbo.COPTC.TC012, dbo.COPTC.TC004, dbo.COPMA.MA002
FROM dbo.COPTC LEFT OUTER JOIN
dbo.COPMA ON dbo.COPTC.TC004 = dbo.COPMA.MA001) AS c ON dbo.MOCTA.TA026 = c.TC001 AND
dbo.MOCTA.TA027 = c.TC002) AS m RIGHT OUTER JOIN
(SELECT x.TB014, x.TB006, x.TB001, x.TB002, x.TB003, x.TB012, x.TB013, x.TB007, x.TB004, x.TB017, y.MD001, y.MD002, y.MD009,
y.MD016, y.MD003, y.MB002, y.MB003, y.MD004, y.MD006, y.MD007
FROM (SELECT TB014, TB006, TB001, TB002, TB003, TB012, TB013, TB007, TB004, TB017
FROM dbo.MOCTB) AS x INNER JOIN
(SELECT A.MD001, A.MD002, A.MD009, A.MD016, A.MD003, A.MB002, A.MB003, A.MD004, A.MD006, A.MD007
FROM dbo.INVMB RIGHT OUTER JOIN
(SELECT dbo.BOMMD.MD001, dbo.BOMMD.MD002, dbo.BOMMD.MD009, dbo.BOMMD.MD016,
dbo.BOMMD.MD003, INVMB_1.MB002, INVMB_1.MB003, dbo.BOMMD.MD004,
dbo.BOMMD.MD006, dbo.BOMMD.MD007
FROM dbo.BOMMD LEFT OUTER JOIN
dbo.INVMB AS INVMB_1 ON dbo.BOMMD.MD003 = INVMB_1.MB001) AS A ON
dbo.INVMB.MB001 = A.MD001) AS y ON x.TB014 = y.MD001 AND x.TB006 = y.MD002) AS n ON
m.TA001 = n.TB001 AND m.TA002 = n.TB002) AS p
where TB001='3001' and TB002='20070921001'