Search This Blog

Wednesday, January 12, 2011

Solve

There is a table day_temp which has three columns did, day and temperature. How do I write a query to get the difference of temperature among each other for 30 days of a month?

Select a.day, a.degree-b.degree from temperature a, temperature b where a.id=b.id+1

1 comment:

  1. create table s(i int ,f int, name varchar(10))
    insert into s
    select 1,23,'Yes'
    union
    select 2,20,'SKS'


    Select a.name, a.f-b.f from s a, s b where a.i=b.i-1

    select * from s

    ReplyDelete