MSSQL – group by latest of each type

MSSQL – group by latest of each type

SELECT t.*
FROM (
    SELECT *, ROW_NUMBER() OVER (
        PARTITION BY {fieldtobegrouped}
        ORDER BY {fieldtosortitemswithingroupby} DESC
    ) AS [RowNum]
    FROM {tablename}
) AS t
WHERE t.[RowNum] = 1
ORDER BY {fieldtosortfinalgroupedlistby} ASC</code>

Solution source: http://stackoverflow.com/questions/3804561/mssql-only-last-entry-in-group-by-with-id#answer-3804617

Granting remote mysql access to a machine

To grant access to a mysql database remotely you need to do the following:

 

Ensure the ‘skip networking’ option is commented out or removed from my.cnf.

Run the following SQL:
GRANT ALL PRIVILEGES ON *.* TO 'user_name'@'host_ip_or_name' WITH GRANT OPTION;
FLUSH PRIVILEGES;

Restart mysql.

Make sure user_name for your host_ip_or_name has the correct password stored.

Five legitimate use cases for NoSQL databases

NoSQL may be one of the most overhyped technology trends in the past couple of years, and a growing number of companies that left their relational databases behind for a NoSQL fling are rethinking their decisions.

However, companies continue to adopt NoSQL solutions, so has the skepticism been overdone? This article looks at 5 legitimate use cases where a NoSQL database has a role to play.

Read full article >