SELECT
COUNT(IPD_Admit_Register_Det.BID) AS BID,
Bed_WardList.WID, Bed_FloorList.FID
FROM
Bed_BedList
INNER JOIN shift_last_bed
INNER JOIN IPD_Admit_Register_Det
ON shift_last_bed.IPDid = IPD_Admit_Register_Det.IPDid
AND shift_last_bed.IDPdid = IPD_Admit_Register_Det.IPDdid
ON Bed_BedList.BID = IPD_Admit_Register_Det.BID
INNER JOIN Bed_FloorList
INNER JOIN Bed_WardList
ON Bed_FloorList.FID = Bed_WardList.FID
ON Bed_BedList.WID = Bed_WardList.WID
GROUP BY
IPD_Admit_Register_Det.BID,
Bed_WardList.WID,
Bed_FloorList.FID
上面的查询在mssql server 2008中成功执行但是当使用phpMyAdmin在MySql中执行时,它会抛出错误,如
1064 - 您的SQL语法出错;检查与MariaDB服务器版本对应的手册,以获得正确的语法
靠近' ON Bed_BedList.BID = IPD_Admit_Register_Det.BID INNER JOIN Bed_FloorList INNER J'在第5行
答案 0 :(得分:0)
伙计感谢您的帮助!最后我得到了正确的查询
SELECT
COUNT(IPD_Admit_Register_Det.BID) AS BID,
Bed_WardList.WID, Bed_FloorList.FID
FROM
shift_last_bed,
IPD_Admit_Register_Det,
Bed_BedList,
Bed_FloorList,
Bed_WardList
WHERE
(shift_last_bed.IPDid = IPD_Admit_Register_Det.IPDid)
AND (shift_last_bed.IPDdid = IPD_Admit_Register_Det.IPDdid)
AND (Bed_BedList.BID = IPD_Admit_Register_Det.BID)
AND (Bed_FloorList.FID = Bed_WardList.FID)
AND (Bed_BedList.WID = Bed_WardList.WID)
GROUP BY
IPD_Admit_Register_Det.BID,
Bed_WardList.WID,
Bed_FloorList.FID