title: Trying to Multiply Several Values from a table
body: <p>I have been spending most of the day reading and trying to figure this out.  I would like to display a list of post_id when length X width X height => 4000</p>
  
  <p>The meta_value in the table is of type LONGTEXT so it has to be CAST prior to doing any multiplication.  I think maybe my SQL order of operations are wrong.  It's been a while since I have done this stuff.</p>
  
  <pre><code>SELECT post_id, meta_key
  FROM postmeta
  WHERE (
          DECLARE @temp_length = (SELECT meta_value
                                FROM postmeta
                               WHERE meta_key = '_length'),
           @temp_width = (SELECT meta_value
                            FROM postmeta
                           WHERE meta_key = '_width'),
  
           @temp_height = (SELECT meta_value
                            FROM postmeta
                           WHERE meta_key = '_height')
          AND
  
      (CAST(@temp_length AS UNSIGNED) * CAST(@temp_width AS UNSIGNED) * CAST(@temp_height AS UNSIGNED) &gt; 250))
  ORDER BY post_id;
  </code></pre>
  
  <p>I am getting ERROR: </p>
  
  <pre><code>MySQL said: Documentation
  
  #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DECLARE @temp_length = (SELECT meta_value
                                    FRO' at line 4
  </code></pre>