firebird mysql_Firebird到MySQL查询迁移 – 选择内部连接子查...
我有一個在我們的Firebird SQL數據模塊中工作的查詢.
我們遷移到MySQL,除了這個,我的所有查詢都沒有問題.
請幫我解決這個問題.我收到一個錯誤:
Failed to Execute. Unknown column ‘part.id’ in ‘on clause’
我的Firebird查詢:
SELECT vendor.name AS "Vendor Name",
Cast(Cast(vendorparts.lastdate AS date) AS CHAR(10)) AS "Last Date",
CASE product.price
WHEN '0' THEN 'CONFIRM'
WHEN NULL THEN 'CONFIRM'
ELSE Round(product.price, 2)
end AS "D-Price",
Cast(vendorparts.lastcost AS DECIMAL(18, 2)) AS "Last Cost",
Cast(lowestcost.lowestcost AS DECIMAL(18, 2)) AS "Lowest Cost",
Cast(highestcost.highestcost AS DECIMAL(18, 2)) AS "Highest Cost",
part.num AS "Part Number",
part.description AS "Part Description"
FROM vendor,
vendorparts,
part,
product
INNER JOIN (SELECT vendorparts.partid,
Max(vendorparts.lastcost) AS Highestcost
FROM vendorparts
GROUP BY vendorparts.partid) AS highestcost
ON part.id = highestcost.partid
INNER JOIN (SELECT vendorparts.partid,
Min(vendorparts.lastcost) AS Lowestcost
FROM vendorparts
GROUP BY vendorparts.partid) AS lowestcost
ON part.id = lowestcost.partid
WHERE vendor.id = vendorparts.vendorid
AND product.partid = part.id
AND vendorparts.partid = part.id
AND vendorparts.lastcost <> 0
除了在子查詢中創建的最低成本和最高成本之外,所有表都在數據庫中.
希望我的要求寫得清楚.但總而言之 – 我需要將這個工作的Firebird查詢遷移到MySQL中.
為什么這會在Firebird中運行而不是在MySQL中運行?
總結
以上是生活随笔為你收集整理的firebird mysql_Firebird到MySQL查询迁移 – 选择内部连接子查...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ansible剧本(playbook)
- 下一篇: 学生用台灯什么颜色的灯光对眼睛好?推荐几