Subject Re: [firebird-support] Self join
Author Damir Tesanovic
If I do
SELECT A.barcode FROM shops A WHERE A.shop_id IN (1, 2);
I will get all barcodes from shops 1 and 2 but I don't want to get that. I
would like to know which barcodes from shop 1 are not in shop 2? I tought
that if I left join those two table with following
SELECT A.shop_id, A.barcode, B.shopId, B.barcode FROM shops A LEFT JOIN
shops B ON (A.barcode =
B.barcode) WHERE A.shop_id = 1 AND B.shop_id = 2;
I will get something like
1, 12345, 2, 12345
1, 34234, 2, null

Damir

On 2/5/06, Nick <nick@...> wrote:
>
> SELECT A.barcode FROM shops A WHERE A.shop_id IN (1, 2);
>
> would seem to do what you want, if not please explain more fully
>
>
> --
> Nick
> -----We Solve your Computer Problems---
> Panther, Ingres, UNIX, Interbase, Firebird - Available Shortly
>
> -----Original Message-----
> From: firebird-support@yahoogroups.com
> [mailto:firebird-support@yahoogroups.com] On Behalf Of Damir Tesanovic
> Sent: 05 February 2006 02:55
> To: firebird-support@yahoogroups.com
> Subject: [firebird-support] Self join
>
>
> 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]
>
>
>
>
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://firebird.sourceforge.net and click the Resources item
> on the main (top) menu. Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
>
>
>
>
> SPONSORED LINKS
> Technical
> <
> http://groups.yahoo.com/gads?t=ms&k=Technical+support&w1=Technical+support&
>
> w2=Computer+technical+support&w3=Compaq+computer+technical+support&w4=Compaq
>
> +technical+support&w5=Hewlett+packard+technical+support&w6=Microsoft+technic
> al+support&c=6&s=196&.sig=-XIO8GxY6hqd3NaD5WSEyw> support Computer
> <
> http://groups.yahoo.com/gads?t=ms&k=Computer+technical+support&w1=Technical
>
> +support&w2=Computer+technical+support&w3=Compaq+computer+technical+support&
>
> w4=Compaq+technical+support&w5=Hewlett+packard+technical+support&w6=Microsof
> t+technical+support&c=6&s=196&.sig=B29J78SYXnNTjjMFBMznqA> technical
> support
> Compaq
> <
> http://groups.yahoo.com/gads?t=ms&k=Compaq+computer+technical+support&w1=Te
>
> chnical+support&w2=Computer+technical+support&w3=Compaq+computer+technical+s
>
> upport&w4=Compaq+technical+support&w5=Hewlett+packard+technical+support&w6=M
> icrosoft+technical+support&c=6&s=196&.sig=7_je1A94xs82CFXUjEqA6g> computer
> technical support
> Compaq
> <
> http://groups.yahoo.com/gads?t=ms&k=Compaq+technical+support&w1=Technical+s
>
> upport&w2=Computer+technical+support&w3=Compaq+computer+technical+support&w4
>
> =Compaq+technical+support&w5=Hewlett+packard+technical+support&w6=Microsoft+
> technical+support&c=6&s=196&.sig=2zMAuRCo5cJrVBr1Bxa3_w> technical support
> Hewlett
> <
> http://groups.yahoo.com/gads?t=ms&k=Hewlett+packard+technical+support&w1=Te
>
> chnical+support&w2=Computer+technical+support&w3=Compaq+computer+technical+s
>
> upport&w4=Compaq+technical+support&w5=Hewlett+packard+technical+support&w6=M
> icrosoft+technical+support&c=6&s=196&.sig=_ytYU7aXb57AVaeUfmvLcA> packard
> technical support Microsoft
> <
> http://groups.yahoo.com/gads?t=ms&k=Microsoft+technical+support&w1=Technica
>
> l+support&w2=Computer+technical+support&w3=Compaq+computer+technical+support
>
> &w4=Compaq+technical+support&w5=Hewlett+packard+technical+support&w6=Microso
> ft+technical+support&c=6&s=196&.sig=4hRo6NXYavRAbTkaYec5Lw> technical
> support
>
> _____
>
> YAHOO! GROUPS LINKS
>
>
>
> * Visit your group "firebird-support
> <http://groups.yahoo.com/group/firebird-support> " on the web.
>
>
> * To unsubscribe from this group, send an email to:
> firebird-support-unsubscribe@yahoogroups.com
> <mailto:firebird-support-unsubscribe@yahoogroups.com?subject=Unsubscribe>
>
>
> * Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
> <http://docs.yahoo.com/info/terms/> .
>
>
> _____
>
>
>
>
> [Non-text portions of this message have been removed]
>
>
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://firebird.sourceforge.net and click the Resources item
> on the main (top) menu. Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
>
>
>
> SPONSORED LINKS
> Technical support<http://groups.yahoo.com/gads?t=ms&k=Technical+support&w1=Technical+support&w2=Computer+technical+support&w3=Compaq+computer+technical+support&w4=Compaq+technical+support&w5=Hewlett+packard+technical+support&w6=Microsoft+technical+support&c=6&s=196&.sig=-XIO8GxY6hqd3NaD5WSEyw> Computer
> technical support<http://groups.yahoo.com/gads?t=ms&k=Computer+technical+support&w1=Technical+support&w2=Computer+technical+support&w3=Compaq+computer+technical+support&w4=Compaq+technical+support&w5=Hewlett+packard+technical+support&w6=Microsoft+technical+support&c=6&s=196&.sig=B29J78SYXnNTjjMFBMznqA> Compaq
> computer technical support<http://groups.yahoo.com/gads?t=ms&k=Compaq+computer+technical+support&w1=Technical+support&w2=Computer+technical+support&w3=Compaq+computer+technical+support&w4=Compaq+technical+support&w5=Hewlett+packard+technical+support&w6=Microsoft+technical+support&c=6&s=196&.sig=7_je1A94xs82CFXUjEqA6g> Compaq
> technical support<http://groups.yahoo.com/gads?t=ms&k=Compaq+technical+support&w1=Technical+support&w2=Computer+technical+support&w3=Compaq+computer+technical+support&w4=Compaq+technical+support&w5=Hewlett+packard+technical+support&w6=Microsoft+technical+support&c=6&s=196&.sig=2zMAuRCo5cJrVBr1Bxa3_w> Hewlett
> packard technical support<http://groups.yahoo.com/gads?t=ms&k=Hewlett+packard+technical+support&w1=Technical+support&w2=Computer+technical+support&w3=Compaq+computer+technical+support&w4=Compaq+technical+support&w5=Hewlett+packard+technical+support&w6=Microsoft+technical+support&c=6&s=196&.sig=_ytYU7aXb57AVaeUfmvLcA> Microsoft
> technical support<http://groups.yahoo.com/gads?t=ms&k=Microsoft+technical+support&w1=Technical+support&w2=Computer+technical+support&w3=Compaq+computer+technical+support&w4=Compaq+technical+support&w5=Hewlett+packard+technical+support&w6=Microsoft+technical+support&c=6&s=196&.sig=4hRo6NXYavRAbTkaYec5Lw>
> ------------------------------
> YAHOO! GROUPS LINKS
>
>
> - Visit your group "firebird-support<http://groups.yahoo.com/group/firebird-support>"
> on the web.
>
> - To unsubscribe from this group, send an email to:
> firebird-support-unsubscribe@yahoogroups.com<firebird-support-unsubscribe@yahoogroups.com?subject=Unsubscribe>
>
> - Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service <http://docs.yahoo.com/info/terms/>.
>
>
> ------------------------------
>


[Non-text portions of this message have been removed]