Jump to content

Recommended Posts

I have the following MSSQL query which I was able to get to run on an MSSQL 2005 box. Now I need to migrate it to a MYSQL system. I can't seem to get the syntax quite right.

 

SELECT ed.EntityID, ed.CustomerName, ed.IsActive, pd.ProductLine, pd.ProductVersion
FROM ENTITY_DATA ed INNER JOIN 
(SELECT row_number() over(partition by EntityID order by PollingID desc) as seq, 
ProductLine, ProductVersion, EntityID, PollingID FROM POLLING_DATA) pd 
ON ed.EntityID = pd.EntityID WHERE seq = '1' AND ed.IsActive = '1'

 

The goal of the query is to select the most recent instance from the POLLING_DATA for the specific EntityID. In the ENTITY_DATA table, a single entry is created for each customer. In the POLLING_DATA table, multiple entries are created for each customer, each entry containing the specific version of software they are running. I need to select the customer number and name from the ENTITY_DATA table and the most recent version information from the POLLING_DATA table.

Link to comment
https://forums.phpfreaks.com/topic/174654-mysql-syntax-for-mssql-query/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.