MySQL Forums
Forum List  »  Microsoft SQL Server

MS SQL statement to MySQL
Posted by: Casper Casper
Date: April 19, 2012 06:57AM

Hi Guys,

Please help, I need to migrate my MS SQL statement to MySQL statement. Thank you.

select * from (
SELECT dbo.ticket.tn tn, dbo.ticket.create_time As [Created Time], dbo.ticket_history_type.name,
row_number() over(partition by dbo.ticket.tn order by dbo.ticket_history_type.name) As Ticket_Row
FROM dbo.ticket_history inner JOIN
dbo.ticket ON dbo.ticket_history.ticket_id = dbo.ticket.id inner JOIN
dbo.ticket_history_type ON dbo.ticket_history.history_type_id = dbo.ticket_history_type.id
where dbo.ticket.tn not in
(
SELECT dbo.ticket.tn
FROM dbo.ticket_history inner JOIN
dbo.ticket ON dbo.ticket_history.ticket_id = dbo.ticket.id inner JOIN
dbo.ticket_history_type ON dbo.ticket_history.history_type_id = dbo.ticket_history_type.id
where dbo.ticket_history_type.name in ('Move')
) ) XX
where XX.Ticket_Row = 1 and XX.[Created Time] <= '01/01/2014' and XX.[Created Time] >= '01/01/2010'
order by 1


Regards,

Options: ReplyQuote


Subject
Written By
Posted
MS SQL statement to MySQL
April 19, 2012 06:57AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.