tags:

views:

35

answers:

4

I am newer to sql I have a table:

MyTable

column1  column2
-----------------
5        3 
2        2

I need a query that will give me back all of the rows where column1 * column2 > 10?

+1  A: 

SELECT * FROM MyTable WHERE (column1 * column2) > 10;
You can specify as many columns as you want (within reason) and apply math to them in the WHERE clause.

bluevial
+1: FYI: The brackets aren't necessary
OMG Ponies
@OMG Ponies: True, but it makes it slightly more readable, and always putting them in comes in handy when you have many columns.
bluevial
But depending on context, a missing bracket can really screw with results because it might not trigger a syntax error.
OMG Ponies
Thanks that is simpler than I thought it would be. And Thanks for helping me format the question OMG Ponies
Tbone
A: 
select column1, column2
from MyTable
where column1 * column2 > 10
RedFilter
A: 

If I understand you correctly you can do this in the where clause ie select * from mytable where column1*column2 > 10

bigtang
A: 
select * from MyTable where Column1 * Column2 > 10
Russell Durham