views:

14

answers:

1

Hi there

We have a simplified table like this:

TYPE; VALUE
AA; 10
BB; 7
CC; 12

I want to do calculation based on TYPE AA & BB so 10 - 7 = 3

How do I achieve this?

Thanks

+1  A: 

select A.TYPE - B.TYPE from table A, table B where A.TYPE = 'AA' and B.TYPE = 'BB'

Burçin Yazıcı
Except that implied join syntax is a very poor programming technique and you should use explicit joins. Honestly this stuff was replaced in 1992, why are you still using it?
HLGEM
You are right actually but I'm editing procedures more than 5000 lines in sybase and this way is traditional in my job :)
Burçin Yazıcı