title: MYSQL SELECT statement inside CONCAT function
body: <p>I was trying to do something like this in my very big select statement, this code snippet is from the SELECT part of the query</p>
  
  <pre><code>CONCAT((SELECT alias.`date` FROM alias WHERE id IN(latest_id)),'&lt;-',GROUP_CONCAT(
  `alias`.`date` ORDER BY `alias`.`date` DESC SEPARATOR '&lt;-')) AS "date_chain"
  </code></pre>
  
  <p>but I am getting NULL in "date_chain" column. If I only write this</p>
  
  <pre><code>GROUP_CONCAT(
  `alias`.`date` 
  ORDER BY `alias`.`date` DESC SEPARATOR '&lt;-') AS "date_chain"
  </code></pre>
  
  <p>It works. </p>
  
  <p>But I want to concat the latest date in the start of this chain. </p>
  
  <p>adding full SQL</p>
  
  <pre><code>SELECT latest_id,CONCAT((SELECT alias.`date`FROM alias WHERE id IN (latest_id)),'&lt;-',
  GROUP_CONCAT(
    `alias`.`date` 
    ORDER BY `alias`.`date` DESC SEPARATOR '&lt;-'
  )) AS "date_chain" FROM alias WHERE latest_id IS NOT NULL GROUP BY latest_id;
  </code></pre>
  
  <p>Kindly can someone help me what is missing in my first syntax? Thank you</p>