You are here: Re: Match field and return to "1" « MsSQL Server « IT news, forums, messages
Re: Match field and return to "1"

Posted by Ed Murphy on 05/14/07 02:15

neolempires2@gmail.com wrote:

> hi..i'm new in sql progaming,
> i try to make make a query that in table field "match" return to "1"
> if no member record in another table and return to "0" if there is any
> record member :
>
> ex
> table member:
> member id
> A 12
> B 14

You have a table and a column of that table with the same
name? Eww, fix that.

> Table Incoming.
> member note match
> C bla..bla 1
> A bla..bla 0
> D bla..bla 1

Assuming that the Incoming table already has rows with correct data
in all columns except possibly 'match':

update Incoming
set match = 0
where member in (select member from member)

update Incoming
set match = 1
where member not in (select member from member)

 

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

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