Re: sql faq
| From: | Curt Zirzow | Date: | Wed, 24 Sep 2003 18:25:16 +0000 |
| Subject: | Re: sql faq | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-163794@lists.php.net to get a copy of this message | ||
* Thus wrote Dan Anderson (dan@mathjunkies.com):
> On Wed, 2003-09-24 at 12:30, Jonatan Pugliese. wrote:
> > select MaeSocio.* from MaeSocio
> > LEFT JOIN MaeSeguro ON MaeSocio.NroSocio=MaeSeguro.NroSocio
> > where MaeSeguro.NroSocio is null
> >
> > MaeSeguro.NroSocio is not null
> >
> > count(*) MaeSocio = 354000
> > count(*) MaeSeguro=108000
> >
> > how i can retype this query?
>
> <Stab in the dark>
> SELECT * FROM MaeSocio WHERE ((MaeSocio.NroSocio = MaeSeguro.NroSocio)
> AND (NroSocio = NULL));
> SELECT * FROM MaeSeguro WHERE MaeSeguro.NroSocio = MaeSocio.NroSocio;
>
> Process the data from there.
>
> Oh, and index MaeSeguro.NroSocio. That will make finding NULL values
> easier. I think. :-D
Also defining MaeSeguro.NroSocio as not null will make things even
faster with the index.
Curt
--
"I used to think I was indecisive, but now I'm not so sure."