需要将ms查询转换成mysql查询
Posted
技术标签:
【中文标题】需要将ms查询转换成mysql查询【英文标题】:Need to convert ms query into mysql query 【发布时间】:2016-10-10 12:55:11 【问题描述】:我正在寻找一个从 ms 到 mysql 的转换器,不是 sceema,而是像这样的查询:
SELECT Last([HISTORY CARD].[PART NUMBER]) AS [LastOfPART NUMBER],
[HISTORY CARD].[SERIAL NUMBER],
Last([HISTORY CARD].POSITION) AS LastOfPOSITION,
Last([HISTORY CARD].[RELEASE DATE TO AIRCRAFT]) AS [LastOfRELEASE DATE TO AIRCRAFT],
Last([HISTORY CARD].[DATE OFF AIRCRAFT]) AS [LastOfDATE OFF AIRCRAFT],
Last([HISTORY CARD].[LAST CAP CHECKED DATE]) AS [LastOfLAST CAP CHECKED DATE],
Last([HISTORY CARD].[DUE CAP CHECK DATE]) AS [LastOfDUE CAP CHECK DATE],
Last([HISTORY CARD].[JOB REMARKS]) AS [LastOfJOB REMARKS],
Last([HISTORY CARD].TSO) AS LastOfTSO,
Last([HISTORY CARD].[BO NUMBER]) AS [LastOfBO NUMBER],
Last([HISTORY CARD].[REPAIR ORDER NUMBER]) AS [LastOfREPAIR ORDER NUMBER],
Last([HISTORY CARD].[LAST OVERHAULED DATE]) AS [LastOfLAST OVERHAULED DATE],
Last([HISTORY CARD].[DUE OVERHAUL DATE]) AS [LastOfDUE OVERHAUL DATE],
Last([HISTORY CARD].[REFRESHER DATE]) AS [LastOfREFRESHER DATE],
Last([HISTORY CARD].[REFRESHER DONE]) AS [LastOfREFRESHER DONE],
Last([HISTORY CARD].[GRN ISSUE DATE]) AS [LastOfGRN ISSUE DATE],
Last([HISTORY CARD].WORKSHEET) AS LastOfWORKSHEET,
Last([HISTORY CARD].[ADDITIONAL ATTACHMENT]) AS [LastOfADDITIONAL ATTACHMENT],
Last([HISTORY CARD].GRN) AS LastOfGRN
FROM [HISTORY CARD]
GROUP BY [HISTORY CARD].[SERIAL NUMBER]
HAVING (((Last([HISTORY CARD].[DUE CAP CHECK DATE])) Between Date() And Date()-60))
ORDER BY Last([HISTORY CARD].[DUE CAP CHECK DATE]) DESC;
【问题讨论】:
为什么包含ms-access
标签?
如果您正在寻找工具,那么您的问题与 SO 无关。如果您不是在寻找工具,那么您到底在追求什么?
你可以为 mysql 使用 LAST_INSERT_ID。
我认为 op 的意思是 ms access
到 mysql
..因为 last 仅在访问中受支持
【参考方案1】:
重现 MS Access 设置函数 LAST
的行为时可能会遇到问题。这个想法是它将返回最后输入的(实时)值,但实际上可能最终看起来是任意的,例如压缩数据库文件可能会在物理上重新排序磁盘上的数据。
见ACC2000: First and Last Functions Return Unexpected Records。
最好的方法可能是找到不同的方法,例如通过添加临时列将表转换为临时表(历史或事务表)。
(有点希望也许您可以简单地将LAST
替换为MAX
?!)
【讨论】:
以上是关于需要将ms查询转换成mysql查询的主要内容,如果未能解决你的问题,请参考以下文章