Re: A simple one that gets me!

2002-10-31 Thread Roger Baklund
* scott [...] > Lets say I had another table called others > And I wanted the query you supplied to INCLUDE items from others that > are not in test > > Eg, (old example) > Others > > Name item > -- > Abc 10 > Def 11 > Geh 12 > Ijk 13 > Lmn 99 This table has a different strucure

: A simple one that gets me!

2002-10-31 Thread scott
To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: A simple one that gets me! * scott > Can you explain the query if you have time! [...] > select t1.* > from test t1 > left join test t2 on > t2.id=2 and > t2.item=t1.item > where t2.id is NULL;

FW: A simple one that gets me!

2002-10-31 Thread scott
:44 To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: A simple one that gets me! * scott > Can you explain the query if you have time! [...] > select t1.* > from test t1 > left join test t2 on > t2.id=2 and > t2.item=t1.item > where t2.id is

Re: A simple one that gets me!

2002-10-31 Thread Roger Baklund
* scott > Can you explain the query if you have time! [...] > select t1.* > from test t1 > left join test t2 on > t2.id=2 and > t2.item=t1.item > where t2.id is NULL; This is a self join. Read one table, left join to the same table looking for the records you do _not_ wan

RE: A simple one that gets me!

2002-10-31 Thread scott
Thanks Roger Works great! Can you explain the query if you have time! Thanks again Scott -Original Message- From: Roger Baklund [mailto:roger@;charlott.no] Sent: 31 October 2002 10:46 To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: A simple one that gets me! * scott >

Re: A simple one that gets me!

2002-10-31 Thread Roger Baklund
* scott > Hi gang > Need to get all items that are not in id supplied > > For example select * from test where id!=2 will do this but it will also > return values that are in 2 if they are also in another id!=2 > In my example if I used the above query I would get > 10,11,12,13,14,17,18,19,20,17,

A simple one that gets me!

2002-10-31 Thread scott
Hi gang Need to get all items that are not in id supplied For example select * from test where id!=2 will do this but it will also return values that are in 2 if they are also in another id!=2 In my example if I used the above query I would get 10,11,12,13,14,17,18,19,20,17,21,22,23 I would not w