我正在尝试将查询从access97迁移到ssms,我已经能够将表从access导入到ssms中,但我需要运行(可能重写)此查询。 我知道sql不能使用!和&但是我一直在这些线路上遇到错误"([T2_BRA]![REF]& [F7])"。 这可能是由于我对sql缺乏了解,任何建议都会很棒! 感谢
SELECT ([T2_BRA]![REF] & [F7]) AS NEWSTYLE,
Suppliers.MasterSupplier,
Dept.MasterDept,
Colour.MasterColour,
Colour.F7,
T2_HEAD.SHORT,
T2_HEAD.[DESC],
T2_HEAD.[GROUP],
T2_HEAD.STYPE,
T2_HEAD.SIZERANGE,
T2_HEAD.SUPPLIER,
T2_HEAD.SUPPREF,
T2_HEAD.VAT,
T2_HEAD.BASESELL,
T2_HEAD.SELL,
T2_HEAD.SELLB,
T2_HEAD.SELL1,
SUM(T2_BRA.Q11) AS QTY1,
SUM(T2_BRA.Q12) AS QTY2,
SUM(T2_BRA.Q13) AS QTY3,
SUM(T2_BRA.Q14) AS QTY4,
SUM(T2_BRA.Q15) AS QTY5,
SUM(T2_BRA.Q16) AS QTY6,
SUM(T2_BRA.Q17) AS QTY7,
SUM(T2_BRA.Q18) AS QTY8,
SUM(T2_BRA.Q19) AS QTY9,
SUM(T2_BRA.Q20) AS QTY10,
SUM(T2_BRA.Q21) AS QTY11,
SUM(T2_BRA.Q22) AS QTY12,
SUM(T2_BRA.Q23) AS QTY13,
T2_SIZES.S01,
T2_SIZES.S02,
T2_SIZES.S03,
T2_SIZES.S04,
T2_SIZES.S05,
T2_SIZES.S06,
T2_SIZES.S07,
T2_SIZES.S08,
T2_SIZES.S09,
T2_SIZES.S10,
T2_SIZES.S11,
T2_SIZES.S12,
T2_SIZES.S13,
T2_HEAD.REF,
Stocktype.MasterStocktype,
SubDept.MasterSubDept,
SUM(T2_BRA.LY11) AS LY1,
SUM(T2_BRA.LY12) AS LY2,
SUM(T2_BRA.LY13) AS LY3,
SUM(T2_BRA.LY14) AS LY4,
SUM(T2_BRA.LY15) AS LY5,
SUM(T2_BRA.LY16) AS LY6,
SUM(T2_BRA.LY17) AS LY7,
SUM(T2_BRA.LY18) AS LY8,
SUM(T2_BRA.LY19) AS LY9,
SUM(T2_BRA.LY20) AS LY10,
SUM(T2_BRA.LY21) AS LY11,
SUM(T2_BRA.LY22) AS LY12,
SUM(T2_BRA.LY23) AS LY13
FROM Descriptions
INNER JOIN T2_BRA ON Descriptions.T2TREF = T2_BRA.REF
INNER JOIN T2_HEAD ON T2_BRA.REF = T2_HEAD.REF
INNER JOIN Colour ON T2_BRA.COLOUR = Colour.NewCol
INNER JOIN Suppliers ON T2_HEAD.SUPPLIER = Suppliers.SuppCode
INNER JOIN Dept ON T2_HEAD.STYPE = Dept.DeptCode
INNER JOIN T2_SIZES ON T2_HEAD.SIZERANGE = T2_SIZES.SIZERANGE
INNER JOIN Stocktype ON T2_HEAD.[GROUP] = Stocktype.StkType
LEFT JOIN SubDept ON T2_HEAD.USER2 = SubDept.SubDeptCode
Group By ([T2_BRA]![REF] & [F7]),
Suppliers.MasterSupplier,
Dept.MasterDept,
Colour.MasterColour,
Colour.F7,
T2_HEAD.Short,
T2_HEAD.[Desc],
T2_HEAD.[Group],
T2_HEAD.STYPE,
T2_HEAD.SIZERANGE,
T2_HEAD.SUPPLIER,
T2_HEAD.SUPPREF,
T2_HEAD.VAT,
T2_HEAD.BASESELL,
T2_HEAD.SELL,
T2_HEAD.SELLB,
T2_HEAD.SELL1,
T2_SIZES.S01,
T2_SIZES.S02,
T2_SIZES.S03,
T2_SIZES.S04,
T2_SIZES.S05,
T2_SIZES.S06,
T2_SIZES.S07,
T2_SIZES.S08,
T2_SIZES.S09,
T2_SIZES.S10,
T2_SIZES.S11,
T2_SIZES.S12,
T2_SIZES.S13,
T2_HEAD.REF,
Stocktype.MasterStocktype,
SubDept.MasterSubDept
ORDER BY ([T2_BRA]![REF] & [F7]) DESC;