pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedtwo table comparison: find a mismatch?
2+ messages / 2 participants
[nested] [flat]
* two table comparison: find a mismatch?
@ 2000-07-28 20:54 Web Manager <web@inter-resa.com>
2000-07-28 21:44 ` Re: two table comparison: find a mismatch? Ross J. Reedstrom <reedstrm@rice.edu>
0 siblings, 1 reply; 2+ messages in thread
From: Web Manager @ 2000-07-28 20:54 UTC (permalink / raw)
To: pgsql-sql
Hello,
here is to table:
Table "city"
Attribute | Type | Modifier
----------------+-------------+---------------------------------------------
city_id | smallint | not null default
nextval('seq_city'::text)
region_id | smallint |
region_tour_id | smallint |
country_id | smallint |
name_fr | varchar(40) |
name | varchar(40) |
url_id | smallint |
Table "region"
Attribute | Type | Modifier
-----------+-------------+----------------------------------------------
region_id | smallint | not null default nextval('seq_region'::text)
country_id| smallint |
name_fr | varchar(40) |
name | varchar(40) |
address | boolean |
url_id | smallint |
I whant to fins a "hole" in the linkage... a region number in the city
table is not in the region table any more.
How can I do that?
Where is the city.region_id <> region.region_id
Thanks!
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Marc Andre Paquin
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: two table comparison: find a mismatch?
2000-07-28 20:54 two table comparison: find a mismatch? Web Manager <web@inter-resa.com>
@ 2000-07-28 21:44 ` Ross J. Reedstrom <reedstrm@rice.edu>
0 siblings, 0 replies; 2+ messages in thread
From: Ross J. Reedstrom @ 2000-07-28 21:44 UTC (permalink / raw)
To: pgsql-sql
On Fri, Jul 28, 2000 at 04:54:58PM -0400, Web Manager wrote:
> Hello,
>
> here is to table:
> Table "city"
> Attribute | Type | Modifier
> ----------------+-------------+---------------------------------------------
> city_id | smallint | not null default
> nextval('seq_city'::text)
> region_id | smallint |
> region_tour_id | smallint |
> country_id | smallint |
> name_fr | varchar(40) |
> name | varchar(40) |
> url_id | smallint |
>
>
> Table "region"
> Attribute | Type | Modifier
> -----------+-------------+----------------------------------------------
> region_id | smallint | not null default nextval('seq_region'::text)
> country_id| smallint |
> name_fr | varchar(40) |
> name | varchar(40) |
> address | boolean |
> url_id | smallint |
>
>
> I whant to fins a "hole" in the linkage... a region number in the city
> table is not in the region table any more.
>
> How can I do that?
>
SELECT * FROM city WHERE region_id NOT IN (SELECT region_id FROM region)
should do it.
BTW, the syntax on your defaults for the id's seems a bit odd. Any reason
your casting the text literal to text? Have we got a bug somewhere?
Ross
--
Ross J. Reedstrom, Ph.D., <reedstrm@rice.edu>
NSBRI Research Scientist/Programmer
Computer and Information Technology Institute
Rice University, 6100 S. Main St., Houston, TX 77005
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2000-07-28 21:44 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-07-28 20:54 two table comparison: find a mismatch? Web Manager <web@inter-resa.com>
2000-07-28 21:44 ` Ross J. Reedstrom <reedstrm@rice.edu>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox