title: Select from table where columns names equal data in a different table
body: <p>I am running this SQL Query:</p>
  
  <pre><code>$sql2="SELECT * from callplanmeta ";
  $rs2=mysql_query($sql2,$conn) or die(mysql_error());
  while($result2=mysql_fetch_array($rs2))
  {
      $column_list[] = $result2["callplanname"];
  }
  
  $sql="SELECT LEAST(NULLIF(".implode(',',$column_list).",0)) as num FROM callplandata ";
  $rs=mysql_query($sql,$conn) or die(mysql_error());
  while($result=mysql_fetch_array($rs))
  {
      echo $result["description"].' - '.$result["num"].'&lt;br&gt;&lt;br&gt;';
  }
  </code></pre>
  
  <p>So in the callplanmeta table are rows with the column names for the callplandata table.</p>
  
  <p>This query is working fine but I need a way to stop it from showing values that are zero from the <code>$result["num"]</code> result. I want it to not show the zero values and just show the next one for every row.</p>