I have really struggled to get a filtered view of some SQL query results to put in a iReport for one of our users.
We are using the subscription feature AND the 'GET_DOCUMENT_CONTENT to verify that users have self-trained on required documents. Using iReport I built this query...
Since this example joins so many tables it has been hard for me to use things like MAX(ACT_DATE). When I try to do that I get the following error
Doug
We are using the subscription feature AND the 'GET_DOCUMENT_CONTENT to verify that users have self-trained on required documents. Using iReport I built this query...
Code: Select all
It does great, except it lists every time they have viewed the current version. I would like to filter by ACT_DATE to only show the last 'GET_DOCUMENT_CONTENT'.SELECT
OKM_ACTIVITY.`ACT_DATE` AS OKM_ACTIVITY_ACT_DATE,
OKM_PROP_SUB_RECEIVED.`PSR_USER` AS OKM_PROP_SUB_RECEIVED_PSR_USER,
OKM_NODE_BASE.`NBS_NAME` AS OKM_NODE_BASE_NBS_NAME,
OKM_NODE_DOCUMENT_VERSION.`NDV_NAME` AS OKM_NODE_DOCUMENT_VERSION_NDV_NAME
FROM
`OKM_PROP_SUB_RECEIVED` OKM_PROP_SUB_RECEIVED INNER JOIN `OKM_NODE_BASE` OKM_NODE_BASE ON OKM_PROP_SUB_RECEIVED.`PSR_NODE` = OKM_NODE_BASE.`NBS_UUID`
INNER JOIN `OKM_NODE_DOCUMENT_VERSION` OKM_NODE_DOCUMENT_VERSION ON OKM_NODE_BASE.`NBS_UUID` = OKM_NODE_DOCUMENT_VERSION.`NDV_PARENT`
INNER JOIN `OKM_ACTIVITY` OKM_ACTIVITY ON OKM_NODE_BASE.`NBS_UUID` = OKM_ACTIVITY.`ACT_ITEM`
WHERE
PSR_FROM = 'jmcnaughton'
AND ACT_ACTION = 'GET_DOCUMENT_CONTENT'
AND NDV_CURRENT = 'T'
ORDER BY PSR_USER, NBS_NAME, NDV_NAME, ACT_DATE DESC
Since this example joins so many tables it has been hard for me to use things like MAX(ACT_DATE). When I try to do that I get the following error
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:I figure there has to be a simple solution to this, but I am very new to all this and it has eluded me so far. Any help would be greatly appreciated.
In aggregated query without GROUP BY, expression #2 of SELECT list contains nonaggregated column 'okmdb.OKM_PROP_SUB_RECEIVED.PSR_USER';
this is incompatible with sql_mode=only_full_group_by
Doug