Subject | merge tables? |
---|---|
Author | caglayantolga |
Post date | 2005-03-01T16:50:15Z |
hi all;
I have two tables :
first table: TBLPRICE second
table
TBLPAYMENT
IDNO | INDEXNO | PRICE IDNO | INDEXNO | PAYMENT
1 | 1 | 100
1 |
1 | 250
1 | 2 | 150
1 |
2 | 300
1 | 3 | 200
I join two tables like this:
Select prc.IDNO, prc.PRICE, pay.PAYMENT from TBLPRICE prc
left join TBLPAYMENT pay on (pay.IDNO = prc.IDNO)
this sql give me this result:
1 | 100 | 250
1 | 100 | 300
1 | 150 | 250
1 | 150 | 300
1 | 200 | 250
1 | 200 | 300
all records repeat, table1.recordcount * table2.recordcount
This is wrong for me.
I want to this result
1 | 100 | 250
1 | 150 | 300
1 | 200 | NULL
can i do it without stored procedure?
I have two tables :
first table: TBLPRICE second
table
TBLPAYMENT
IDNO | INDEXNO | PRICE IDNO | INDEXNO | PAYMENT
1 | 1 | 100
1 |
1 | 250
1 | 2 | 150
1 |
2 | 300
1 | 3 | 200
I join two tables like this:
Select prc.IDNO, prc.PRICE, pay.PAYMENT from TBLPRICE prc
left join TBLPAYMENT pay on (pay.IDNO = prc.IDNO)
this sql give me this result:
1 | 100 | 250
1 | 100 | 300
1 | 150 | 250
1 | 150 | 300
1 | 200 | 250
1 | 200 | 300
all records repeat, table1.recordcount * table2.recordcount
This is wrong for me.
I want to this result
1 | 100 | 250
1 | 150 | 300
1 | 200 | NULL
can i do it without stored procedure?