将查询从MSSQL转换为MYSQL

时间:2013-06-10 08:27:30

标签: mysql sql-server

我有以下查询需要从MSSQL转换为MYSQL

select TOP 7500 Verdunster1B_Digital.LocalCol,
       Verdunster1B_Digital.Funktion_Heizband_Verdunster1B,
       Maschinenraum_Digital.Funktion_Ventilatoren_Verdampfer_Msr,
       Maschinenraum_Digital.Funktion_Glykolpumpe1_Tankverbindung
from Verdunster1B_Digital
  inner join Maschinenraum_Digital 
          on DateAdd (Millisecond,- DatePart (Millisecond,Maschinenraum_Digital.LocalCol),Maschinenraum_Digital.LocalCol) = DateAdd (Millisecond,- DatePart (Millisecond,Verdunster1B_Digital.LocalCol),Verdunster1B_Digital.LocalCol)
where Verdunster1B_Digital.LocalCol between '2013-06-09T00:00:00' and '2013-06-10T00:00:00'
and   Verdunster1B_Digital.ReasonCol = 'Zeit Ein'
and   (   MINUTE (Verdunster1B_Digital.LocalCol) = 0 
       or MINUTE (Verdunster1B_Digital.LocalCol) = 15 
       or MINUTE (Verdunster1B_Digital.LocalCol) = 30 
       or MINUTE (Verdunster1B_Digital.LocalCol) = 45)

它使用我以前从未见过或使用的命令,我尝试的所有东西都没有用。将它转换为mysql查询的任何帮助都是非常受欢迎的。

谢谢!

1 个答案:

答案 0 :(得分:0)

试试这个 -

SELECT
      v.LocalCol
    , v.Funktion_Heizband_Verdunster1B
    , m.Funktion_Ventilatoren_Verdampfer_Msr
    , m.Funktion_Glykolpumpe1_Tankverbindung
FROM Verdunster1B_Digital AS v
JOIN Maschinenraum_Digital AS m ON m.LocalCol = v.LocalCol
WHERE v.LocalCol BETWEEN '20130609' AND '20130610' 
      AND v.ReasonCol = 'Zeit Ein' 
      AND MINUTE(v.LocalCol) IN (0, 15, 30, 45)
LIMIT 0, 7500