Re: Tricky database query involving two tables
| From: | Ron Brogden | Date: | Thu, 01 Mar 2001 03:04:25 +0000 |
| Subject: | Re: Tricky database query involving two tables | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-7033@lists.php.net to get a copy of this message | ||
At 09:50 PM 2/28/2001 -0500, you wrote:
Is there a way to do this in MySQL? Or do I have to just query everything, and then have the skipping logic be in PHP? I'd love to encapsulate this in a query. Would it involve subqueries (something I know that MySQL doesn't directly support)?The part that seems to be missing here is that you are note limiting the relationships between table A and table B, you are just slapping them together. There should probably be a field that you use to lock rows together between the tables: select a.foo,b.bar from A left outer join B ON a.foo=b.foo where b.bar=1 If you have known relationship between the tables shared between the queries then selecting "b.bar!=1" should actually work. Hard to get real specific though without seeing a "real" query and table schema. Cheers -----------------------------------------------------------------------------
Island Net AMT Solutions Group Inc. Telephone: 250 383-0096 1412 Quadra Toll Free: 1 800 331-3055 Victoria, B.C. Fax: 250 383-6698 V8W 2L1 E-Mail: support@islandnet.com Canada WWW: http://www.islandnet.com/-----------------------------------------------------------------------------