Skip to content

Instantly share code, notes, and snippets.

@Chetan496
Created September 25, 2016 08:16
Show Gist options
  • Save Chetan496/ceb9c14ce9b53497e8071b637f869d59 to your computer and use it in GitHub Desktop.
Save Chetan496/ceb9c14ce9b53497e8071b637f869d59 to your computer and use it in GitHub Desktop.
SELECT id, instanceId, processModelId, GROUP_CONCAT(CONCAT_WS("=", variableName, oldValue)) AS OLDVALUE,
GROUP_CONCAT(CONCAT_WS("=", variableName, newValue)) AS NEWVALUE , parentVariableName FROM `Object_History`
GROUP BY instanceId, parentVariableName;
@Chetan496
Copy link
Author

A better version:

SELECT id, instanceId, processModelId, GROUP_CONCAT(CONCAT_WS("=", variableName, oldValue) SEPARATOR ", ") AS OLDVALUE,
GROUP_CONCAT(CONCAT_WS("=", variableName, newValue) SEPARATOR ", ") AS NEWVALUE , parentVariableName FROM Object_History
GROUP BY instanceId, parentVariableName;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment