Justtechjobs.com Find a programming school near you






Online Campus Both


php3-list | 199903

Re: [PHP3] MySql - Please help? I'm at the end of my rope... From: Hans Anderson (hans <email protected>)
Date: 03/18/99

Maybe something like this will point you in the right direction (this code
may not be exact, but it might help)

SELECT DISTINCTROW Table1.ColumnName
FROM Table1 LEFT JOIN Table2 ON Table1.ColumnName = Table2.ColumnName
WHERE (((Table2.ColumnName) Is Null));

For a table setup like this:

create table Table1 (ColumnName Char(50))
create table Table2 (ColumnName Char(50))

with entries like this:

Table1 Table2

Name1 Name2
Name2 Name3
Name3

It would return Name1

This code is untested, but (I hope) should be close to getting you going in
the right direction.

At 01:38 PM 3/18/99 -0600, Chris Boget wrote:
>... and dangling.
>
>I have 2 tables: Certificate and Claims. Each has their own
>data with the exception of 2 fields which have the exact same
>data. Those two fields are:
>
>Certificate table Claims Table
>
> uid policy_num
> certnum certnum
>
>(ie, uid and policy num have the same data; both certnum
>fields in each table have the same data. Basically the
>information in the Claims table is the info for a claim
>pending for a particular certificate. Gawd, I'm so bad
>at trying to explain myself; I'm sorry).
>
>I have the following query that is supposed to select
>all the records in the Certificate table that do not
>appear in the Claims table (ie, don't have a claim
>pending against them):
>
>SELECT DISTINCT cert.* FROM
>certificate cert, claims WHERE
>cert.uid='$client' AND
>cert.uid=claims.policy_num AND
>(cert.status='O' OR cert.status='C') AND
>claims.certnum!=cert.certnum ORDER BY
>cert.certnum
>
>($client is whoever is using the claim form at the
>moment)
>
>Granted, I'm not a SQL expert, but the above _looks_
>correct; it _looks_ like it should work. However, this
>is what it is doing:
>
>Using the above query as is, it get *all* the records
>in the certificate table for the particular $client.
>However, when I make the following change:
>
>claims.certnum=cert.certnum
>(as opposed to !=)
>
>then I get only those records that are the same in
>both tables. WTF? If it gets the same records when
>I change the query so that it reads like just above,
>then shouldn't it get the records from the Certificate
>table that aren't in the Claims table when I make the
>query read so that the fields are not equal?
>
>I've been working on this problem for 3 days and I
>cannot find out why it isn't working. I'm so frustrated,
>it's not even funny. Can someone, anyone, offer anything
>that can help me?
>
>I'm using version 3.22.13-beta of MySql (or at least,
>that's the version # it reports when I run mysql)
>
>thanx,
>Chris
>
>
>
>--
>PHP 3 Mailing List http://www.php.net/
>To unsubscribe send an empty message to php3-unsubscribe <email protected>
>To subscribe to the digest list: php3-digest-subscribe <email protected>
>For help: php3-help <email protected> Archive:
http://www.php.net/mailsearch.php3
>List administrator: zeev-list-admin <email protected>
>

Hans Anderson, President .:. me <email protected>
The Hans Anderson Corporation .:. (406)549-6524
PO Box 426, Missoula, MT 59806
.:. http://www.hansanderson.com .:.
.:. http://www.govauctions.org .:.
.:. http://www.goofiness.com .:.

,.;: <-- evolution of the colon

--
PHP 3 Mailing List   http://www.php.net/
To unsubscribe send an empty message to php3-unsubscribe <email protected>
To subscribe to the digest list:  php3-digest-subscribe <email protected>
For help: php3-help <email protected>  Archive:  http://www.php.net/mailsearch.php3
List administrator:  zeev-list-admin <email protected>