Re: MySQL advanced select?
| From: | Robin Vickery | Date: | Fri, 08 Sep 2000 13:25:56 +0000 |
| Subject: | Re: MySQL advanced select? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-15873@lists.php.net to get a copy of this message | ||
magnus@programmering.nu (Magnus Hammar) writes:
> >oh.. silly me, should have read the subject too. ;-)
>
> =)
>
> >Still .. are we talking about column names being different, or the values
> >for specific columns? Maybe paste your table definitions and explain more
> >specific what you want compared.
>
> The value inside the fields that are different form the values inside the
> other fields in an other table, but in the same database.
> Say that 10 times in a row ;)
>
> It's hard to explain, but what I'm looking for is this:
> --------------------------------------------------------
> Database: userdata
>
> Table: tUserEmail
> Fields: userid int(11),email varchar(255)
>
> Table: tEmail
> Fields: mailid int(11), email_copy varchar(255), active tinyint(1)
>
> What I want is to select all values in "email" in table "tUserEmail" that
> is _not_ the same as any value in field "email_copy" in the table
> "tEmail".
>
> I want to sync the tables without having to select _all_ fields and then
> check if the value is the same or not.
>
> Do you know what I'm trying to say here? :)
SELECT tUserEmail.email FROM tUserEmail LEFT JOIN tEmail ON tUserEmail.email=tEmail.email_copy where
tEmail.email_copy IS NULL;
I think...
-robin
--
Robin Vickery...............................................
Planet-Three, 3A West Point, Warple Way, London, W3 0RG, UK
Email: robin@planet-three.net Phone: +44 (0)870 729 5444