Click here to Skip to main content
15,890,512 members
Home / Discussions / Database
   

Database

 
GeneralCasts from DataReader Pin
Brady Kelly22-Apr-07 0:52
Brady Kelly22-Apr-07 0:52 
GeneralRe: Casts from DataReader Pin
xibeifeijian22-Apr-07 15:22
xibeifeijian22-Apr-07 15:22 
QuestionHow to add a column to an existing SQL database table Pin
furjaw21-Apr-07 20:29
furjaw21-Apr-07 20:29 
AnswerRe: How to add a column to an existing SQL database table Pin
kubben22-Apr-07 1:51
kubben22-Apr-07 1:51 
GeneralRe: How to add a column to an existing SQL database table Pin
Jerry Hammond22-Apr-07 4:26
Jerry Hammond22-Apr-07 4:26 
GeneralRe: How to add a column to an existing SQL database table Pin
furjaw22-Apr-07 17:27
furjaw22-Apr-07 17:27 
GeneralRe: How to add a column to an existing SQL database table Pin
furjaw22-Apr-07 18:48
furjaw22-Apr-07 18:48 
QuestionHow to query this? Pin
Arun.Immanuel21-Apr-07 18:55
Arun.Immanuel21-Apr-07 18:55 
Hi everyone!.

I have 2 columns in a table say col1 and col2.
Sample Data:
===========
col1   col2
60     1000
20     0
30     0
40     1500
20     0
70     0
80     0


I need a query that will display the following output:
col1   col2    col3
===================
60     1000    1000
20     0       980 
30     0       950 
40     1500    1500
20     0       1480 
70     0       1410 
80     0       1330 


Description:
============
if col2 not equal to ZERO then 
    col3=col2.
else
    col3=previous col3 - current col1

I don't need cursors.

Thanks in advance.

Regards,
Arun Kumar.A 

AnswerRe: How to query this? Pin
Colin Angus Mackay21-Apr-07 23:42
Colin Angus Mackay21-Apr-07 23:42 
GeneralRe: How to query this? Pin
Arun.Immanuel21-Apr-07 23:58
Arun.Immanuel21-Apr-07 23:58 
GeneralRe: How to query this? [modified] Pin
Arun.Immanuel22-Apr-07 0:25
Arun.Immanuel22-Apr-07 0:25 
GeneralRe: How to query this? Pin
DQNOK24-Apr-07 12:03
professionalDQNOK24-Apr-07 12:03 
QuestionHow to work with manage code in the dll Pin
Romiks21-Apr-07 8:55
Romiks21-Apr-07 8:55 
QuestionSQL Server enum datatype problem Pin
tanvir.faraj20-Apr-07 22:31
tanvir.faraj20-Apr-07 22:31 
AnswerRe: SQL Server enum datatype problem Pin
Sascha Andres22-Apr-07 3:22
Sascha Andres22-Apr-07 3:22 
Questionquery of select max number Pin
Mohammad Daba'an20-Apr-07 19:48
Mohammad Daba'an20-Apr-07 19:48 
AnswerRe: query of select max number Pin
japel20-Apr-07 20:03
japel20-Apr-07 20:03 
GeneralRe: query of select max number Pin
Mohammad Daba'an20-Apr-07 20:06
Mohammad Daba'an20-Apr-07 20:06 
GeneralRe: query of select max number Pin
japel20-Apr-07 20:24
japel20-Apr-07 20:24 
GeneralRe: query of select max number Pin
Mohammad Daba'an20-Apr-07 20:34
Mohammad Daba'an20-Apr-07 20:34 
GeneralRe: query of select max number Pin
Arun.Immanuel21-Apr-07 3:59
Arun.Immanuel21-Apr-07 3:59 
Questionstored Procedure Pin
vengaqua20-Apr-07 19:44
vengaqua20-Apr-07 19:44 
AnswerRe: stored Procedure Pin
Colin Angus Mackay20-Apr-07 22:16
Colin Angus Mackay20-Apr-07 22:16 
QuestionSync Access with SQL2005 Pin
japel20-Apr-07 19:37
japel20-Apr-07 19:37 
AnswerRe: Sync Access with SQL2005 Pin
S Douglas22-Apr-07 1:32
professionalS Douglas22-Apr-07 1:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.