[nycphp-talk] Still Mysql Selects
Alberto dos Santos
acas at sapo.pt
Wed Jun 22 09:57:05 EDT 2005
Dan. Thanks for your tip, but it doesn't seem to work.
If i use your code, it returns me all of catalog_reading contents, meaning I
do not have any null values on my tested table.
On the other hand, if I say NOT NULL, it returns all the lines of
catalog_reading that are present on the tested table. It's nice, but not at
all what I need ;)
Any other thoughts?
Cheers
--
Alberto dos Santos
email: acas at sapo.pt
web: otrebla.no.sapo.pt
skype: fatflash
msn: fatflash at hotmail.com
Salvaguarda: Este email está protegido de vírus e programas maliciosos
-----Original Message-----
From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On
Behalf Of Dan Cech
Sent: quarta-feira, 22 de Junho de 2005 12:42
To: NYPHP Talk
Subject: Re: [nycphp-talk] Still Mysql Selects
Alberto dos Santos wrote:
> I have a table called "CATALOG_READING" with two entries, one is the ID
> (CR_ID) and the other a value.
> Then I have 16 tables each with 4 rows that have a value from CR_ID, in
> order to use the values from the CATALOG_READING table in different
> situations.
>
> What I need to check is which values from CR_ID are NOT USED in any of the
> other tables, so I can identify and remove it.
SELECT c.cr_id
FROM catalog_reading AS c
LEFT JOIN table_x AS x ON x.cr_id=c.cr_id
LEFT JOIN table_y AS y ON y.cr_id=c.cr_id
LEFT JOIN table_z AS z ON z.cr_id=c.cr_id
...
WHERE x.cr_id IS NULL
AND y.cr_id IS NULL
AND z.cr_id IS NULL
...
Give something like that a shot.
Dan
_______________________________________________
New York PHP Talk Mailing List
AMP Technology
Supporting Apache, MySQL and PHP
http://lists.nyphp.org/mailman/listinfo/talk
http://www.nyphp.org
More information about the talk
mailing list