Help me for simple Logic

Posted by Pramodmca09 under Others on 9/29/2009 | Views : 1067 | Status : [Member] | Replies : 2
I have devloped an application(windows). In which I'm joing two tables.
table like
Table1->Order | PostnigDate| Quantity | MatDoc |
----------------------------------------------------------------------
1 | 10/13/2009 | 1000 | 523EW |
1 | 10/13/2009 | 1000 | 100WT |
3 | 10/13/2009 | 454 | E23E44 |

Table2->|Order | PDate | Quantity | coulm1 | coulm2.....
--------------------------------------------------------------------------------
1 | 10/13/2009 | 1000 | 2W32 | 231
1 | 10/13/2009 | 1000 | 2W32 | 332

Im fetching 1st row from 1st Table and matching it rows from Table2 with and Order, PDate and Quantity.
So I got 2matching rows 4m Table2.
Again for 2nd Row from 1st Table I'm getting 2 matching rows.
I wants Logic that will match 1st row from Table1 with 1stRow from Table2.(out of all matching row)

And 2nd row from Table1 with 2nd Row from Table2..(out of all matching row)
In above Case I got 4rows. where 2row should be there 1 to 1 relation.
Reply




Responses

Posted by: Rtpharry on: 9/30/2009 [Member] [MVP] Bronze

Up
0
Down
Hi, sorry I dont understand the question. How does it relate to simple login? Are you looking for sql join advice?

Pramodmca09, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Pramodmca09 on: 9/30/2009 [Member] Starter

Up
0
Down
See I wants to join two tables.
I may have more than one rows having same coulmn value Order,PostingDate,Quantity...
Table1->Order | PostnigDate| Quantity | MatDoc |
----------------------------------------------------------------------
1 | 10/13/2009 | 1000 | 523EW |
1 | 10/13/2009 | 1000 | 100WT |
3 | 10/13/2009 | 454 | E23E44 |

like this.
See I hv 2rows hving Order=1 Date=10/13/2009 and Quantity=1000 but different coulmn value of MatDoc (in italic)

Now in second table I will also have 2Rows as there are 2Rows in first Table.
So When I will have 1st row from Table1 then query should select 1st mathing row from table2.

and when i will have 2nd row from table then query shuld select 2nd row from table2.

1More Example: if Table1 will have 4 Rows having same Order,PostingDate and Quantity. Then Table 2 will also have 4Rows corresponds to 4Rows in Table1.
I want 1st RW 4m Table1 to 1st row(Table2). leave next three row from Tble2.
Then
4th RW 4m Table1 to 4th row(Table2). leave first 3 rows from Tble2.


Pramodmca09, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response