Thank You all... I got the result table I need.
Bye Luca ----- Original Message ----- From: "Becker, Holger" <[EMAIL PROTECTED]> To: "Luca Calderano" <[EMAIL PROTECTED]>; <[email protected]> Sent: Thursday, September 14, 2006 4:19 PM Subject: RE: sql help needed > Hi, > > In this case I would suggest to use a union. > > This won't give you exactly what you want but I think it's more transparent > > For example: > > select a.date, a.value, 'planed' from a > union all > select b.date, b.value, 'payed' from b > order by 1 > > In my opinion to get "planed" and "payed" in one row you have to use more than one command. > > For example: > > declare ca cursor for select rowno p, date, value from a order by date for reuse > declare cb cursor for select rowno p, date, value from b order by date for reuse > select > ca.p, ca.date, ca.value, cb.date, cb.value > where > ca.p = cb.p (+) > order by > ca.p > > > Best regards > Holger > > > -----Original Message----- > > From: Luca Calderano [mailto:[EMAIL PROTECTED] > > Sent: Donnerstag, 14. September 2006 15:12 > > To: [email protected] > > Subject: Re: sql help needed > > > > I'm going to explain my problem in detail as you can > > understand what I want > > to do: > > > > Table A contains a "return plan" that is Mr. X has planned to > > give me some > > money this way: > > > > eu 50 on 2006-07-01 > > eu 100 on 2006-09-01 > > eu 200 on 2006-10-01 > > > > Table B contains the real paiment Mr. X did, that is: > > > > eu 500 on 2006-07-25 > > eu 200 on 2006-09-13 > > > > So I need a table showing both planned and real values that is: > > > > PROGR | A.Date | A.VALUE | B.Date | B.Value > > 1 | 2006-07-01 | 50 | 2006-07-25 | 500 > > 2 | 2006-09-01 | 100 | 2006-09-13 | 200 > > 3 | 2006-10-01 | 200 | ? | ? > > > > Hope this could help to solve my problem. > > > > > > ----- Original Message ----- > > From: "Schroeder, Alexander" <[EMAIL PROTECTED]> > > To: "Luca Calderano" <[EMAIL PROTECTED]>; <[email protected]> > > Sent: Thursday, September 14, 2006 1:28 PM > > Subject: RE: sql help needed > > > > > > > Hello Luca, > > > > > > sorry, but I cannot see what will be the common field > > between your tables. > > It looked as you > > > wanted to group the values by a common 'value' column, as Elke also > > deduced. However, as this > > > is not the case we cannot deduce what kind of result you > > want to produce, > > and which relation > > > between the data in A and B you want to express or use as qualifier. > > > > > > Regards > > > Alexander Schröder > > > > > > -----Original Message----- > > > From: Luca Calderano [mailto:[EMAIL PROTECTED] > > > Sent: Donnerstag, 14. September 2006 13:19 > > > To: [email protected] > > > Subject: Re: sql help needed > > > > > > I cannot use the query you proposed as the tables A and B > > never have the > > > same values for the field "Value" that is > > > > > > Table A (the table is unordered by Date) > > > ----------- > > > Date | Value > > > 2006-09-01 | 100 > > > 2006-10-01 | 200 > > > 2006-07-01 | 50 > > > > > > Table B (the table is unordered by Date) > > > ----------- > > > Date | Value > > > 2006-09-13 | 200 > > > 2006-07-25 | 500 > > > > > > RESULT (the result table is ordered by the field "A.Date" > > and by the field > > > "B.Date") > > > -------------- > > > PROGR | A.Date | A.VALUE | B.Date | B.Value > > > 1 | 2006-07-01 | 50 | 2006-07-25 | 500 > > > 2 | 2006-09-01 | 100 | 2006-09-13 | 200 > > > 3 | 2006-10-01 | 200 | ? > > | ? > > > > > > > > > ----- Original Message ----- > > > From: "Schroeder, Alexander" <[EMAIL PROTECTED]> > > > To: "Luca Calderano" <[EMAIL PROTECTED]>; <[email protected]> > > > Sent: Thursday, September 14, 2006 11:39 AM > > > Subject: RE: sql help needed > > > > > > > > > > Hello Luca, > > > > > > > > do you mean something like: > > > > > > > > select rowno, a."DATE" AS a_date, a."VALUE", b."DATE" as b_date, > > b."VALUE" > > > > from a, b where a."VALUE" = b."VALUE" (+) ORDER BY a_date, b_date > > > > > > > > Regards > > > > Alexander Schröder > > > > SAP Labs Berlin > > > > > > > > > > -- > > > MaxDB Discussion Mailing List > > > For list archives: http://lists.mysql.com/maxdb > > > To unsubscribe: > > http://lists.mysql.com/[EMAIL PROTECTED] > > > > > > > > > -- > > > MaxDB Discussion Mailing List > > > For list archives: http://lists.mysql.com/maxdb > > > To unsubscribe: > > http://lists.mysql.com/[EMAIL PROTECTED] > > > > > > > > > > -- > > MaxDB Discussion Mailing List > > For list archives: http://lists.mysql.com/maxdb > > To unsubscribe: > > http://lists.mysql.com/[EMAIL PROTECTED] > > > > > -- MaxDB Discussion Mailing List For list archives: http://lists.mysql.com/maxdb To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
