You are here: Re: comparing two mysql tables « All PHP « IT news, forums, messages
Re: comparing two mysql tables

Posted by Dejan on 06/23/06 00:45

tnx very very much.
this solved my problem.

ZeldorBlat <zeldorblat@gmail.com> wrote in message
news:1150981336.894298.254440@u72g2000cwu.googlegroups.com...
>
> Dejan wrote:
> > Hy
> >
> > Plz help me.
> > I have two identical mysql tables. I nead to compare it and update the
> > diferences.
> >
> > table1
> > id name surname zauzetost
> > --------------------------
> > 1 John Doe 0
> > 2 Jane Doe 1
> > 3 Mike Dean 0
> >
> >
> > table2
> > id name surname zauzetost
> > --------------------------
> > 1 John Doe 0
> > 2 Jane Doe 0
> >
> >
> > Ok, in table 1 i have 'zauzetost' with it's values, now script neads to
> > compare its values and if found diference update table2 with table1
values.
> >
> > In this case: Jane Doe from table1 'zauzetost' value is 1, in table2
is 0.
> > Its diferent so script neads to update table2 'zauzetost' value for Jane
Doe
> > into 1.
> >
> > Not very complicated, buth i dont know how to make it.
> > Tnx in advance for your brain cells.
> > Dejan
>
> Assuming that the id column is the same in both tables:
>
> update table2
> set zauzetost = t1.zauzetost
> from table2 t2, table1 t1
> where t2.id = t1.id
>

 

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

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