1. SQL Example SQL example SQL Example SQL Example SQL Example SQL Example SQL Example (word limit)

SELECT
	record.dossier_id,
	argMax(record.record_id,
	record.timestamp) AS record_id,
	argMax(record.camera_id,
	record.timestamp) AS camera_id
FROM
	xx.xx record
INNER JOIN xx.xx meta on
	record.dossier_id = meta.dossier_id
WHERE
	meta.source_repos IN([ 'xx' ],[ 'xx' ])
GROUP BY
	record.dossier_id
Copy the code

2. XML presentation in Java code

<select id="dossierQuery" parameterType="xx.xx" resultMap="BaseResultMap"> SELECT record.dossier_id AS dossier_id, argMax(record.record_id,record.timestamp) AS record_id, argMax(record.camera_id,record.timestamp) AS camera_id FROM xx.xx record INNER JOIN ${databaseName}.xx meta ON record.dossier_id = meta.dossier_id WHERE <if test="sourceRepos! =null"> meta.source_repos IN ( <foreach item="item" collection="sourceRepos" separator=","> ['${item}'] </foreach> ) </if> GROUP BY record.dossier_id </select>Copy the code