Click here to Skip to main content
15,907,905 members
Home / Discussions / Database
   

Database

 
Questioniterating values in sql Pin
n_gchaitra22-Jul-07 0:07
n_gchaitra22-Jul-07 0:07 
AnswerRe: iterating values in sql Pin
Joe22-Jul-07 21:21
Joe22-Jul-07 21:21 
GeneralRe: iterating values in sql Pin
n_gchaitra23-Jul-07 1:53
n_gchaitra23-Jul-07 1:53 
AnswerRe: iterating values in sql Pin
jonathan1523-Jul-07 5:34
jonathan1523-Jul-07 5:34 
GeneralRe: iterating values in sql Pin
n_gchaitra23-Jul-07 17:31
n_gchaitra23-Jul-07 17:31 
QuestionUpdate clause using if condition Pin
n_gchaitra21-Jul-07 22:05
n_gchaitra21-Jul-07 22:05 
AnswerRe: Update clause using if condition Pin
Colin Angus Mackay21-Jul-07 22:48
Colin Angus Mackay21-Jul-07 22:48 
Questiondatedifference from two different tables Pin
n_gchaitra21-Jul-07 21:01
n_gchaitra21-Jul-07 21:01 
Hi,

I want to find the date difference of date1 and date2. But these two colums are present in different tables. I have used joins but not getting proper results because the no of rows i am getting is the cartesian product of the two tables. I am includeing two tables and the result i have got after using joins. Please tell the right way to do this.

Tran_type Partno Description Transactiondate Quantity Rate Balqty
--------- ------ ----------- ------------------- ------------ --------- -------
R ABC NULL 2005-01-01 00:00:00 15.0 20.0 15.0
R ABC NULL 2005-04-02 00:00:00 15.0 30.0 15.0
R ABC NULL 2005-09-01 00:00:00 50.0 30.0 50.0

(3 row(s) affected)

Tran_type Partno Description Transactiondate Quantity Rate Balqty
---------- ------ ----------- ------------------- ----------- --------- --------
S ABC NULL 2005-06-03 00:00:00 5.0 25.0 NULL
S ABC NULL 2005-07-01 00:00:00 5.0 10.0 NULL
S ABC NULL 2006-06-01 00:00:00 15.0 50.0 NULL

(3 row(s) affected)

tran_type transactiondate transactiondate tran_type Date diff
--------- --------------------------- --------------------------- ---------- -----------
R 2005-01-01 00:00:00 2005-06-03 00:00:00 S 153
R 2005-04-02 00:00:00 2005-06-03 00:00:00 S 62
R 2005-09-01 00:00:00 2005-06-03 00:00:00 S -90
R 2005-01-01 00:00:00 2005-07-01 00:00:00 S 181
R 2005-04-02 00:00:00 2005-07-01 00:00:00 S 90
R 2005-09-01 00:00:00 2005-07-01 00:00:00 S -62
R 2005-01-01 00:00:00 2006-06-01 00:00:00 S 516
R 2005-04-02 00:00:00 2006-06-01 00:00:00 S 425
R 2005-09-01 00:00:00 2006-06-01 00:00:00 S 273

(9 row(s) affected)





Chaitra N

AnswerRe: datedifference from two different tables Pin
N a v a n e e t h22-Jul-07 22:51
N a v a n e e t h22-Jul-07 22:51 
GeneralRe: datedifference from two different tables Pin
n_gchaitra23-Jul-07 1:51
n_gchaitra23-Jul-07 1:51 
QuestionAccess to one table in quick succession cause problem. Pin
cosma21721-Jul-07 11:04
cosma21721-Jul-07 11:04 
QuestionReport genaration: Data exchange to MS-Excel Pin
Ravisubrahmanya21-Jul-07 3:11
Ravisubrahmanya21-Jul-07 3:11 
AnswerRe: Report genaration: Data exchange to MS-Excel Pin
Rob Graham21-Jul-07 4:07
Rob Graham21-Jul-07 4:07 
AnswerRe: Report genaration: Data exchange to MS-Excel Pin
Ravisubrahmanya21-Jul-07 6:54
Ravisubrahmanya21-Jul-07 6:54 
QuestionRe: Report genaration: Data exchange to MS-Excel Pin
Ravisubrahmanya21-Jul-07 7:26
Ravisubrahmanya21-Jul-07 7:26 
QuestionHow to restore MSDE server data into SQL server database? Pin
Ravisubrahmanya21-Jul-07 2:45
Ravisubrahmanya21-Jul-07 2:45 
AnswerRe: How to restore MSDE server data into SQL server database? Pin
Rob Graham21-Jul-07 3:57
Rob Graham21-Jul-07 3:57 
Questionunexpected behaviour of Reportviewer control Pin
Rupesh Kumar Swami20-Jul-07 23:00
Rupesh Kumar Swami20-Jul-07 23:00 
QuestionSelecting records of last two days: Pin
Shahzad.Aslam20-Jul-07 21:43
Shahzad.Aslam20-Jul-07 21:43 
AnswerRe: Selecting records of last two days: Pin
Christian Graus20-Jul-07 21:47
protectorChristian Graus20-Jul-07 21:47 
AnswerRe: Selecting records of last two days: Pin
bablu_singh22-Jul-07 19:49
bablu_singh22-Jul-07 19:49 
Questionhelp for sql query plz Pin
amjad ali shah20-Jul-07 2:09
amjad ali shah20-Jul-07 2:09 
AnswerRe: help for sql query plz Pin
leckey20-Jul-07 4:13
leckey20-Jul-07 4:13 
AnswerRe: help for sql query plz Pin
andyharman20-Jul-07 4:19
professionalandyharman20-Jul-07 4:19 
GeneralRe: help for sql query plz Pin
Paul Conrad20-Jul-07 5:54
professionalPaul Conrad20-Jul-07 5:54 

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.