At a glance I would guess that NULL values in one or both of your tables
is the culprit. NULL values always return false.
Example:
A quick test on my database:
select count(*) FROM tbl_employee;
count
---
2689
select count(*) FROM tbl_employee WHERE username IS NULL;
count
---
3
Table orders defines the column order_code as a serial, which simple
makes a trigger which gives a new value to the column on insert. Note
that there is NO guarantee that ths column will be unique. You can
manually update the value to whatever you want. If you wish this column
to be unique,
It's a low-tech solution but you could:
begin
update t1 set seq=-1 where id=5
update t1 set seq=5 where id=4
update t1 set seq=4 where id=-1
end
This is assuming that you don't naturally have -1 as a valid value of
that column.
chester c young wrote:
table t1:
id integer primary key,
However, if customers or suppliers can have multiple accounts, you are
going to need an intermediate table, as suggested by Neil.
Scratch that. If accounts can have multiple owners you'll need an
intermediate table.
---(end of broadcast)---
I've never seen anything like that. I'm sure it's conceivable that you
could write a weird trigger for it, but you have to consider
maintainability, and what your queries are going to look like. I
haven't seen your datamodel, but it would seem that you could accomplish
what you're looking for
Hello all,
I have a fairly complex query whose performance problem I have isolated
to a fairly small subset. The pertinent parts of the table structure
are as follows:
//-
tbl_claim
claim_id integer SERIAL PRIMARY KEY;
claimnum varchar(32);
//---