Display first column ina row with prev row last column

  • Hi

    I want to retrieve a query as

    Queue Current WaitList

    Queue for a row is the waitlist for prev row. For the first row, queue is 0.

    How can I write query to achive this?

    thanks in advance

  • You will need to post some more information for a complete solution.

    Post your table ddls and some sample data and i am sure someone will be able to help

  • Hi

    Thanks for the reply.

    My table definition is

    Month Demand Capacity

    Jul-2008 100 150

    Aug-2008 200 210

    Sep-2008 150 145

    Report should show

    Month Queue Demand Capacity Waste (Capacity - Demand)

    Jul-2008 0 100 150 50

    Aug-2008 50 200 210 10

    Sep-2008 10 150 145 0

    Hope you understand.

    thanks

  • Thanks, does your table have a primary key?

  • Hi,

    Thanks for the reply. Actually, this report is generated from 3 temp tables. The columns are as mentioned in my prev post. I can put one identity column in the table.

    Asume I have PK and the name is tempid.

    cheers

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply