create table vals (
x float,
y float
);
insert into vals values (2,4);
insert into vals values (2,2);
insert into vals values (2,1);
insert into vals values (2,0);
select x/y from vals where y0 and x/y1;
will give a divide by zero error as A=(y0) and B=(x/y1) can be evaluated in
any order (A
You didn't mention what version of Postgres, but in 7.1beta, you could do
the following (pretty sure on the syntax):
SELECT a.x/b.y FROM vals a, (SELECT y FROM vals WHERE y 0) b WHERE (a.x
/ b.y) 1;
In anything else, you could try a view:
CREATE VIEW valid_vals AS SELECT y FROM vals WHERE y
Patrick Welche [EMAIL PROTECTED] writes:
select x/y from vals where y0 and x/y1;
will give a divide by zero error as A=(y0) and B=(x/y1) can be evaluated in
any order (A and B = B and A). I obviously would like (y0) to happen first,
but I don't see how this can be achieved.. Any ideas?
Of
: SELECT a.x/b.y FROM vals a, (SELECT y FROM vals WHERE y 0) b WHERE (a.x
: / b.y) 1;
How much of a performance hit is there when using a select in the FROM
clause? Is it even noticeable? How much better is it to create a static
view?
-Dan
will give a divide by zero error as A=(y0) and B=(x/y1) can be
evaluated in
any order (A and B = B and A). I obviously would like (y0) to happen
first,
but I don't see how this can be achieved.. Any ideas?
I have one idea that would be nifty to implement. In some compilers, you
can turn