Re: MYSQL query help
| From: | Fred | Date: | Sat, 15 Dec 2001 02:16:57 +0000 |
| Subject: | Re: MYSQL query help | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-15051@lists.php.net to get a copy of this message | ||
There are several ways to get around the lack of subselect support in mysql.
For your situation you can simply use:
SELECT * FROM lib_asset_tbl, lib_copy_tbl WHERE lib_asset_tbl.material_id <>
'' AND lib_asset_tbl.asset_id = lib_copy_tbl.asset_id
of course, this will return a row for every instance of a many to many
relationship, so you may want to use a GROUP BY clause to reduce the number
of rows in the result.
Fred
Harpreet <harpreet@crispincorp.com> wrote in message
news:000001c184ac$6ed6b250$38c8a8c0@harpreet...
> I dont think we can use 'IN' and 'NOT IN' in mysql. Is there an
alternative
> that would work?
>
> select * from lib_asset_tbl where material_id <>'' and asset_id in (select
> asset_id from lib_copy_tbl)
>
> Help is appreciated.
>
> Regards,
> Harpreet Kaur
> Software Developer
> Crispin Corporations Inc.
>
>