mysql Laravel 9查询生成器MS Access SQL转换

t5fffqht  于 2022-10-31  发布在  Mysql
关注(0)|答案(1)|浏览(118)

我有一个访问旧Access数据库的SQL查询。我需要将其转换为使用查询生成器。我不需要模型,只是为了能够使用QB查询数据库。

sql = "SELECT tblSU.Site, tlkpSUDesc.ESR_SUcat, tlkpSUDesc.ESR_SUcatdisp, tlkpSUDesc.SUDesc, tlkpSUTyp.SUTyp, tblSU.SUNum"
sql = sql & " FROM tlkpSUTyp RIGHT JOIN (tlkpSUDesc RIGHT JOIN tblSU ON tlkpSUDesc.SUDescCode = tblSU.SUDescCode) ON tlkpSUTyp.SUTypCode = tblSU.SUTypCode"
sql = sql & " WHERE (((tblSU.Site)='" & request("Site") & "') AND ((tlkpSUDesc.ESR_SUcat)='" & request("Crit") & "') AND (Not (tblSU.SUTypCode)='GEN'))"
sql = sql & " ORDER BY tblSU.Site, tlkpSUDesc.ESR_SUcatdisp, tblSU.SUDescCode, CDbl(IIf(InStr([tblSU]![SUNum],'-'),Left([tblSU]![SUNum],Len([tblSU]![SUNum])-2),[tblSU]![SUNum]))"

相关问题