Select and sums from another table. Whats wrong with this SQL? -


What is wrong with this SQL?

  SELECT Id, (Select from SUM (VALUE) SomeTable) as SumValue, GETDATE () from MyTable where SumValue & gt; 0  "post-text" itemprop = "text"> 

You can not use the aliases column in the same query in the same question ORDER BY.

It must be subcurred

  SELECT Id, SumValue, GETDATE () (SELECT Id, (select from the table SUM (VALUE)) SumValue FROM MyTable) X where properties And & gt; 0   

This is the common case. For your specific query, this does not make sense because the subkey is not correlated with an external query, so either show any rows, or all the rows (with the same amount) show I would just assume that you query the query Simplified because a table name of "table" does not really work.

Comments