From: | "Mark G(dot) Franz" <mgfranz(at)pe(dot)net> |
---|---|
To: | <pgsql-novice(at)postgresql(dot)org> |
Subject: | Problem with WHERE statement |
Date: | 2001-07-03 18:09:55 |
Message-ID: | 019001c103eb$5d65e000$6401a8c0@mgflaptop |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
I am trying to retrieve DISTINCT records from a joined table set. Here is a basic table layout;
Registration Table-
ID | Cost | Date
1 | 6.95 | 6/30/01
1 | 0.00 | 6/30/01
2 | 2.95 | 6/31/01
2 | 0.00 | 6/31/01
...
Customer Table-
ID | Name | Company
1 | Fred | XYZ
2 | Tom | ABC
My query string;
"SELECT DISTINCT Registration.ID, Registration.Cost, Customer.ID, Customer.Name, Customer.Company FROM Registration, Customer WHERE Customer.ID=Registration.ID AND Registration.Cost > 0.00"
This always returns every record that matches ID, I only want to return the record where the Cost is a true value. Any ideas?
Mark
From | Date | Subject | |
---|---|---|---|
Next Message | Allan Engelhardt | 2001-07-03 18:54:30 | Character collating order |
Previous Message | Jason Cox | 2001-07-03 16:17:49 | Starting Postgres using pg_ctl and options |