PDA

View Full Version : SQL Question - Combine two resultsets


SNYP40A1
April 14th, 2008, 04:30 PM
I have one query which looks like this:

select result1, param1, param2
from sometable

select result2, param1, param2
from sometable

From this, I want to get this:

select (result2 - result1), param1, param2
from sometable

result2 and result1 will be real numbers so subtraction should work. If not, could I get

select result2, result1, param1, param2
from sometable

pmasiar
April 14th, 2008, 07:01 PM
You need to JOIN tables, right? What are keys?