Subject | Self join |
---|---|
Author | Damir Tesanovic |
Post date | 2006-02-05T02:54:33Z |
Hi!
I have a one table containing:
shop_id, barcode, amount
1, 12345, 54
1, 12346, 34
1, 34234, 23
2, 12345, 32
2, 10000, 12
3, 43245, 2
I tryed with
SELECT A.barcode, B.barcode FROM shops A LEFT JOIN shops B ON (A.barcode =
B.barcode) WHERE A.shop_id = 1 AND B.shop_id = 2;
command to get all barcodes from shop 1 and those from shop 2 even if there
is not pair but it doesn't work. Am I missing something?
Damir
[Non-text portions of this message have been removed]
I have a one table containing:
shop_id, barcode, amount
1, 12345, 54
1, 12346, 34
1, 34234, 23
2, 12345, 32
2, 10000, 12
3, 43245, 2
I tryed with
SELECT A.barcode, B.barcode FROM shops A LEFT JOIN shops B ON (A.barcode =
B.barcode) WHERE A.shop_id = 1 AND B.shop_id = 2;
command to get all barcodes from shop 1 and those from shop 2 even if there
is not pair but it doesn't work. Am I missing something?
Damir
[Non-text portions of this message have been removed]