Perhaps this...? It would work, but depending how many rows are in the
table, it could become incredibly slow.
The max rows in either table would be about 1000 or so, which isn't
too many. There also should be a hole lot of inserting going on.
ALTER TABLE table1 ADD CHECK (extension NOT IN (S
Perhaps this...? It would work, but depending how many rows are in the
table, it could become incredibly slow.
ALTER TABLE table1 ADD CHECK (extension NOT IN (SELECT extension FROM
table2));
And the converse for table2:
ALTER TABLE table2 ADD CHECK (extension NOT IN (SELECT extension FROM
table1)
> Could you give me a hand ?
>
> I have a ZipCode table and my address table
>
> I just would like to find out all matches that my zipcode table has where my
> address table appears like this:
>
> Elmo Street, 30
>
> I would like my SQL find out all matches we can find 'Elmo', 'Street'.
>
se
Guy,
Could you give me a hand ?
I have a ZipCode table and my address table
I just would like to find out all matches that my zipcode table has where my
address table appears like this:
Elmo Street, 30
I would like my SQL find out all matches we can find 'Elmo', 'Street'.
The commas, space
>
> create table table1 (
> id SERIAL PRIMARY KEY
> extension UNIQUE,
>
> )
>
> create table table2 (
> id SERIAL PRIMARY KEY
> extension UNIQUE,
>
> )
>
> Basically table 1 and table 2 both have the concept of an extension
> that must be unique but the rest of the info in the tables are
> di
"Claus Guttesen" <[EMAIL PROTECTED]> writes:
> select order_id from
> (select o.order_id from orders o join order_lines ol using (order_id)
> where o.time > '2006-01-01T00:00' and o.time < '2007-01-01T00:00'
> and (ol.item_id = 10 or ol.item_id = 11 or ol.item_id = 12) group by
> o.order_id) a
Jon Horsman wrote:
> Basically table 1 and table 2 both have the concept of an extension
> that must be unique but the rest of the info in the tables are
> different. I need to ensure that if i add an entry to table 1 with
> extension 1000 that it will fail if there is already an entry in
> table2
Tom Lane wrote:
Richard Huxton writes:
Tom Lane wrote:
"Sabin Coanda" <[EMAIL PROTECTED]> writes:
I used the function array_to_string, and I found it ignores NULL values,
e.g. array_to_string( 'ARRAY[1,NULL,3]', ',' ) returns '1,3'.
Do you have a better idea?
If you're being strict it shou
Richard Huxton writes:
> Tom Lane wrote:
>> "Sabin Coanda" <[EMAIL PROTECTED]> writes:
>>> I used the function array_to_string, and I found it ignores NULL values,
>>> e.g. array_to_string( 'ARRAY[1,NULL,3]', ',' ) returns '1,3'.
>>
>> Do you have a better idea?
> If you're being strict it shou
Tom Lane wrote:
"Sabin Coanda" <[EMAIL PROTECTED]> writes:
I used the function array_to_string, and I found it ignores NULL values,
e.g. array_to_string( 'ARRAY[1,NULL,3]', ',' ) returns '1,3'.
Do you have a better idea?
If you're being strict it should presumably return NULL for the whole
"Sabin Coanda" <[EMAIL PROTECTED]> writes:
> I used the function array_to_string, and I found it ignores NULL values,
> e.g. array_to_string( 'ARRAY[1,NULL,3]', ',' ) returns '1,3'.
Do you have a better idea?
regards, tom lane
---(end of broadcast
> create table table1 (
> id SERIAL PRIMARY KEY
> extension UNIQUE,
I can't find anything about this syntax in the docs...
Oops, i'm missing a comma on that first line, should have been:
create table table1 (
id SERIAL PRIMARY KEY,
extension UNIQUE,
)
I think, you should write a TRIGGER for
Claus Guttesen wrote:
> Why does select and select(count) produce two different results?
count(expression) only counts nonnull values.
--
Peter Eisentraut
http://developer.postgresql.org/~petere/
---(end of broadcast)---
TIP 2: Don't 'kill -9' the
am Tue, dem 27.03.2007, um 9:21:44 -0400 mailte Jon Horsman folgendes:
> I was wondering if someone could help point me in the right direction
> w.r.t. foreign unique constraints. I'm working on a legacy database
> and have a new requirement and am not sure how to do it.
>
> I have something li
I was wondering if someone could help point me in the right direction
w.r.t. foreign unique constraints. I'm working on a legacy database
and have a new requirement and am not sure how to do it.
I have something like this
create table table1 (
id SERIAL PRIMARY KEY
extension UNIQUE,
)
create
Forgot to mention that this is on postgresql 7.4.14 and FreeBSD 6.2.
regards
Claus
Hi.
I'm performing the following query to get all items sold in 2006 which
are in category prints or gifts, but not in extra:
select order_id from
(select o.order_id from orders o join order_lines ol using (or
Hi.
I'm performing the following query to get all items sold in 2006 which
are in category prints or gifts, but not in extra:
select order_id from
(select o.order_id from orders o join order_lines ol using (order_id)
where o.time > '2006-01-01T00:00' and o.time < '2007-01-01T00:00'
and (ol.ite
17 matches
Mail list logo