这是sybase创建视图的脚本,请问写成MySql脚本怎么写?CREATEVIEWdbo.VW_FHLogASSELECTyw.YWLOGID,zl.wdh,yw.ACCNO,yw.YJKNUMBER,yw.OPDATE,FH.FHDate,yw.OPTIME,dbo.REF_YWLog.OpTyp...
这是sybase创建视图的脚本,请问写成MySql脚本怎么写?
CREATE VIEW dbo.VW_FHLog
AS
SELECT yw.YWLOGID, zl.wdh, yw.ACCNO, yw.YJKNUMBER, yw.OPDATE, FH.FHDate,
yw.OPTIME, dbo.REF_YWLog.OpType AS OPresult, dbo.HY.HYNAME AS OpName,
FH.opcode, yw.BANKID
FROM dbo.YWLOG yw INNER JOIN
(SELECT s1.opcode, s1.ACCNO, s1.opdate AS FHDate,
s1.optype AS FHResult
FROM ywlog AS S1
WHERE YWLOGID IN
(SELECT MIN(S2.YWLOGID)
FROM ywlog AS S2, YWLOG AS YW
WHERE YW.ACCNO = S2.ACCNO AND YW.OPDATE <= S2.opDATE AND
s2.optype IN (9, 10)
GROUP BY s2.accno)) FH ON yw.ACCNO = FH.ACCNO INNER JOIN
NewSeal.dbo.Zl zl ON zl.ACCNO = yw.ACCNO INNER JOIN
dbo.REF_YWLog ON FH.FHResult = dbo.REF_YWLog.REFID INNER JOIN
dbo.HY ON FH.opcode = dbo.HY.HYDH
展开