You are here: Re: need help with LEFT JOIN statemen « MsSQL Server « IT news, forums, messages
Re: need help with LEFT JOIN statemen

Posted by boa on 10/02/22 11:55

* eurolinux@hotmail.com wrote, On 14.08.2006 19:42:
> I'm trying to left join a table where there are two identical fields
>
> I want to select all records in a field from the left table and only
> those records from the identical field of the right table which are not
> bigger or smaller then 1
>
> both field in the tables are integer data type
>
> Can someone help
>
> I tried this code but it does not work, I'm not sure if I can use these
> operators <>
> __________________________________________
> SELECT Table1.field1,Table2.field1
> FROM Table1 RIGHT JOIN Table2 ON (Table1.field1 = Table2.field2) AND
> not (Table1.field1 > (Table2.field2+1)) AND not (Table1.field1 <
> (Table2.field2-1))
> __________________________________________
>

select t1.f1, t2.f1
from t1, t2
where t1.f1 between t2.f1 - 1 and t2.f1 + 1

Is that what you meant? :-)

HTH
Bjørn

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация