All pastes #25971 Raw Edit

Anonymous

public text v1 · immutable
#25971 ·published 2005-10-19 15:48 UTC
rendered paste body
SELECT e.id, e.date, e.amount, w.id, w.date, w.amount
FROM useroutcome w, userincome e
WHERE w.nonresaccountid = '1'
AND e.accountid = w.accountid;


 id   	  date   	  amount   	  id   	  date   	  amount
1 	2005-10-10 00:00:00 	150 	1 	2005-11-11 00:00:00 	10
1 	2005-10-10 00:00:00 	150 	3 	2004-00-00 00:00:00 	70
1 	2005-10-10 00:00:00 	150 	4 	2005-11-08 00:00:00 	40
4 	2005-11-06 00:00:00 	20 	1 	2005-11-11 00:00:00 	10
4 	2005-11-06 00:00:00 	20 	3 	2004-00-00 00:00:00 	70
4 	2005-11-06 00:00:00 	20 	4 	2005-11-08 00:00:00 	40
5 	2005-12-12 00:00:00 	50 	1 	2005-11-11 00:00:00 	10
5 	2005-12-12 00:00:00 	50 	3 	2004-00-00 00:00:00 	70
5 	2005-12-12 00:00:00 	50 	4 	2005-11-08 00:00:00 	40



-------------------------------------

select e.date, e.amount, w. date, w.amount 
from useroutcome w, userincome e 
where w.accountid = '1'
and e.accountid = w.accountid;

-
Response I get:
 date   	  amount   	  date   	  amount
2005-10-10 00:00:00 	150 	2005-11-11 00:00:00 	10
2005-10-10 00:00:00 	150 	2004-00-00 00:00:00 	70
2005-10-10 00:00:00 	150 	2005-11-08 00:00:00 	40
2005-11-06 00:00:00 	20 	2005-11-11 00:00:00 	10
2005-11-06 00:00:00 	20 	2004-00-00 00:00:00 	70
2005-11-06 00:00:00 	20 	2005-11-08 00:00:00 	40
2005-12-12 00:00:00 	50 	2005-11-11 00:00:00 	10
2005-12-12 00:00:00 	50 	2004-00-00 00:00:00 	70
2005-12-12 00:00:00 	50 	2005-11-08 00:00:00 	40

-
SELECT date, amount FROM userincome where accountid = '1';

 date   	  amount
2005-10-10 00:00:00 	150
2005-11-06 00:00:00 	20
2005-12-12 00:00:00 	50

-
SELECT date, amount FROM useroutcome where accountid = '1';

 date   	  amount
2005-11-11 00:00:00 	10
2004-00-00 00:00:00 	70
2005-11-08 00:00:00 	40