const char *select_recent_version_with_basejob[4] = {
/* MySQL */
"SELECT FileId, Job.JobId, FileIndex, File.PathId, File.FilenameId, LStat, MD5 "
-"FROM ( "
+"FROM Job, File, ( "
"SELECT MAX(JobTDate) AS JobTDate, PathId, FilenameId "
"FROM ( "
"SELECT JobTDate, PathId, FilenameId "
"WHERE BaseFiles.JobId IN (%s) "
") AS temp GROUP BY PathId, FilenameId "
") AS T1 "
- "Job, File, "
"WHERE Job.JobId IN (%s) "
"AND Job.JobTDate = T1.JobTDate "
"AND File.PathId = T1.PathId "
/* SQLite */
"SELECT FileId, Job.JobId, FileIndex, File.PathId, File.FilenameId, LStat, MD5 "
-"FROM ( "
+"FROM Job, File, ( "
"SELECT MAX(JobTDate) AS JobTDate, PathId, FilenameId "
"FROM ( "
"SELECT JobTDate, PathId, FilenameId "
"JOIN Job ON (BaseJobId = Job.JobId) "
"WHERE BaseFiles.JobId IN (%s) "
") AS temp GROUP BY PathId, FilenameId "
- ") AS T1, "
- "Job, File "
+ ") AS T1 "
"WHERE Job.JobId IN (%s) "
"AND Job.JobTDate = T1.JobTDate "
"AND File.PathId = T1.PathId "
/* SQLite3 */
"SELECT FileId, Job.JobId, FileIndex, File.PathId, File.FilenameId, LStat, MD5 "
-"FROM ( "
+"FROM Job, File, ( "
"SELECT MAX(JobTDate) AS JobTDate, PathId, FilenameId "
"FROM ( "
"SELECT JobTDate, PathId, FilenameId "
"JOIN Job ON (BaseJobId = Job.JobId) "
"WHERE BaseFiles.JobId IN (%s) "
") AS temp GROUP BY PathId, FilenameId "
- ") AS T1, "
- "Job, File "
+ ") AS T1 "
"WHERE Job.JobId IN (%s) "
"AND Job.JobTDate = T1.JobTDate "
"AND File.PathId = T1.PathId "