I need to use a concat function which has an argument returned by select query like this
CONCAT(classification_version.NAME,' ', (select x.NAME,min(DATEDIFF(e.SEND_DATE, x.OPTENTION_DATE)) AS DT_DIFF from classification_version x inner join classification_element y on x.id_project=y.ID_PROJECT inner join email e on x.id_project=e.ID_PROJECT_AMENDMENT where y.ID_PROJECT=project.id and y.ID_COMPANY=company.id and e.SEND_DATE>x.OPTENTION_DATE group by e.id,e.SEND_DATE order by e.SEND_DATE ASC) This is only a part of a query that I have. I need to return min(datediff) because I need the corresponding name value only. But it throws an error that Operand should contain 1 column(s). I cannot use inner queries for the select statement as project.id and company.id will not be available to me then. IS there any way to solve this?
This is only a part of a query that I haveDo you really expect any effort on our part if this isn't the entire query?